Repository navigation
ci: give every push to main its own concurrency group, so the next merge no longer cancels the previous merge's tests - #25454
Merged
Conversation
…rge no longer cancels the run that saves the Turbo cache seed ci.yml and lint.yml keyed every push run on `refs/heads/main`, so with `cancel-in-progress: true` the next merge cancelled the previous merge's run (CI 32 of 40, Lint 27 of 40 on 2026-10-23) before its "Save Turbo cache (main only)" steps ran, and PR shards and lint lanes restored a stale seed. The push segment of both keys is now `github.event.after` (the pushed commit), placed after the PR number and before `github.ref`, so schedule, workflow_dispatch and merge_group still fall through to the ref and a PR still groups by its number. `cancel-in-progress: false` alone was not used: GitHub keeps one pending run per group and cancels it when a third arrives (replayed on the same 40 arrivals, 18 CI push runs would still die). scripts/ci/scheduled-full-run.mjs --check-concurrency now judges that invariant: its event contexts carry each event's real run-varying fields (sha, run id, the push payload's `after`), two pushes of two commits must not share a group, and two schedule, dispatch or same-PR runs must still share one, so a run-unique key (`github.run_id`, `github.sha`) is still refused. The self-test adds a firing control on the old shared-push key. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Vs5pqqS7xcq3XeoTXPF98
…ot a seed fix The maintainer's ruling on #25373 (comment 6366946328) lands the per-commit push key as a coverage fix: the "Save Turbo cache (main only)" steps are `if: always()` and already save on a cancelled job, so what a cancelled push run loses is its own merge's Test Core and lint verdict, not the seed. The ci.yml and lint.yml comments and the gate's finding text now say that, and the measured count is corrected to 31 of 40 CI push runs. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Vs5pqqS7xcq3XeoTXPF98
This was referenced Oct 23, 2026
os-zhuang
approved these changes
Oct 23, 2026
os-zhuang
marked this pull request as ready for review
October 23, 2026 17:50
os-zhuang
enabled auto-merge
October 23, 2026 17:50
This was referenced Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Elon · project thread
Fixes #25373
Clause-②: no
Metadata-protocol: none
Every push to
mainnow gets its own CI and Lint concurrency group, keyed by the pushed commit. The next merge no longer cancels the previous merge's run, so each merge's own--affectedTest Core and its lint/typecheck verdict finish onmain. This lands as a coverage fix, per the maintainer's ruling on the card (batch #5 item 1, letter C, comment 6366946328). It does not make PR builds faster; the speed question moves to a sibling card on Turbo seeds vs the 10 GB Actions cache pool.What changed
ci.ymlandlint.yml, the workflow-levelconcurrency.group. The last segment goes fromgithub.event.pull_request.number || github.reftogithub.event.pull_request.number || github.event.after || github.ref.github.event.afteris set only on a push, so:ci-CI-push-<sha>, unique per merge;schedule,workflow_dispatchandmerge_groupcarry noafterand still fall through togithub.ref, so they group exactly as before;pull_requestthe PR number still wins first, so a new push to a PR still cancels its stale run.cancel-in-progressstaystrue; with a per-commit push group it never fires on a push. The block comments are rewritten to the new rule.scripts/ci/scheduled-full-run.mjs --check-concurrency(the gatelint.ymlruns over these two keys) now pins the new invariant:github.sha,github.run_id, and the payload'safteron a push and a PR synchronize, none on schedule, dispatch or queue;scheduleruns on twomainheads, twoworkflow_dispatchruns and two heads of the same PR must still share one group. A run-unique key is still refused:github.run_idas before, and now alsogithub.sha, which is run-unique onscheduletoo;The evaluator's grammar is unchanged (context paths, quoted literals,
||).Why
cancel-in-progress: falsewas not enough (the card's option (a)/(b))GitHub keeps one running and one pending run per concurrency group; a third arrival cancels the pending one. Both options on the card keep a shared push group, so they still cancel push runs. Replayed on the real arrival times of the 40 push runs below, with a 27 min CI and 16 min Lint run:
Baseline (GitHub Actions API, push-to-main runs 2026-10-23 01:03Z → 11:03Z)
ci.ymland the one inlint.ymlareif: always() && github.event_name == 'push', andalways()runs on a cancelled job. Cancelled run 39923516471 saved all six Test Core shard seeds. Shard 4 (job 120315257857) logged "Cache saved with key: Linux-turbo-test-4-main-3306cada…" after uploading 2,135,596,699 bytes. What a cancelled run loses is its merge's Test Core verdict.Cost
The previously cancelled runs now run to completion. Measured inputs:
The card estimated about 100. The repository is public and both workflows run on
ubuntu-latest, so per the ruling the cost is runner concurrency, not billing. On concurrency, two push runs now overlap at today's cadence; the guard in the acceptance below watches the PR queue for it.Acceptance (rewritten by the ruling, comment 6366946328)
mainafter landing, every push run's own Test Core completes, and no push CI or Lint run is cancelled by its successor (Actions API: push runs with conclusioncancelled= 0).started_at−created_at) stays ≤ 1 min. If it does not, revert this PR.The shard-closure and Build Core speed criteria leave this card. They go with the sibling cache-pool card, which the
domain:devxseat files.Risks and rollback
github.shaexcept the vendored Console dist cache (ci.yml~:3112, saved only on a cache miss), which is keyed by file hashes. Two overlapping runs that both miss can race to save that key;actions/cache/saveanswers the loser with a warning ("Unable to reserve cache…"), not a failure. No push-battery job writes a ref, deploys or comments.scheduled-full-run.mjs --release-gatereads completed runs at or before the version commit; more of them now concludesuccess.check-shard-attestation.mjsstill classifies a superseded PR run by the same annotation prefix.Local verification (head 7da22f0)
node scripts/ci/scheduled-full-run.mjs --self-test:self-test OK(concurrency battery: 32 cases).node scripts/ci/scheduled-full-run.mjs --check-concurrency: both files OK.ci.yml's key put back to the shared-push shape,--check-concurrencyexited 1 naming "two pushes to main share the concurrency group 'ci-…-push-refs/heads/main'", and--self-testthrew. Withlint.ymlreverted the same way,--check-concurrencyexited 1 with the same finding. Both files were restored, and the gate exited 0 again.node scripts/pm/dispatch-gates.mjs) was run as a node-only subset, all exit 0:check:pm-dispatch-gates(fast tier, 334.6 s),check-step-collectorsand its--self-test,check-ci-filter-parity,check-self-test-wiredand its--self-test,check-self-test-workflow-commands,check-scripts-symbol-anchors,check-published-list-mirrors,check-declaration-mirrors,check-platform-checklist-watchdog,check-shard-attestation --self-test,check-adr-0087-registration --base origin/main,check-empty-changeset --base origin/main,check-comment-mask-corpus,check-skills-token-ratchet,check-aggregator-roster,check-closing-keyword-parity,pm/bare-root-worklist --self-test,check-nul-bytes. The rest of the farm is left to CI.yaml), andconcurrencyreads back as written.check-governed-merges.mjs --branch HEAD: GOVERNED, landing tier H (.github/workflows/**×2);scripts/ci/scheduled-full-run.mjsis not on the register.skip-changeset: no published package is touched (.github/workflows/**,scripts/ci/**).Acceptance notes
ci.ymlandlint.ymlonly. A per-commit push key needs the concurrency gate's invariant changed, so thedomain:devxseat approved addingscripts/ci/scheduled-full-run.mjson 2026-10-23 before any write.claude/project-thread-9d8u29, the name the session was given, notclaude/issue-25373-…. The claim (comment 6364129096) names it.tscrun on every shard although vitest never reads a.d.ts; setOS_SKIP_DTS=1on the shard legs and their main seed #25375 also editci.yml.mainwas re-read and merged before each push; neither had landed at 7da22f0.维护者速读(草稿)
改了什么:每次合并到 main 触发的 CI 和 Lint 运行,现在各自独占一个并发组,按提交区分。下一次合并不会再把上一次的运行取消掉。负责检查这条规则的门禁脚本同步改写,旧的共享写法会被它判红。
为什么改:今天 40 次合并里,有 31 次 CI 运行在测试中途被下一次合并取消。这些合并在 main 上就没有自己的测试结论,要等每小时一次的全量运行。缓存其实一直有存(保存步骤在取消时也会执行),所以这次改的是覆盖面,不是速度。速度问题另开一张缓存池的卡。
风险与代价(含回滚):每次合并多花约 85 runner-min,最多约 183。仓库公开,用的是 GitHub 托管机,所以代价是并发,不是账单。两次 main 运行会重叠;如果之后 10 个 PR 的排队中位数超过 1 分钟,就回退本 PR。回退只需 revert,门禁改动会一起撤回。
席位意见:同意落地(devx 席位已在 head 7da22f0 复核,见 #25373 上的 ACCEPT 评论)。改法和裁定 C 一致:只给 push 事件按提交分组,定时、手动、合并队列和 PR 的分组不变。门禁自测在该 head 复跑通过,CI 全绿。代价是并发,有排队守卫兜底,回退成本低。
你要做的:本 PR 改了
.github/workflows/**,属于 Tier H,需要 GOVERNED_APPROVERS 中的一位批准后,席位才会翻 ready 并落地。Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_014Vs5pqqS7xcq3XeoTXPF98