Repository navigation
ci: a run on main is never superseded, so main is actually measured - #663
Merged
Merged
Conversation
A parallel triage found main's CI runs are almost all `cancelled`. The data: 37 of the last 40 runs on main ended cancelled, one failed, and that one failure is the run that exposed 35 test failures across 19 cases. Main's mac health has not been red-and-ignored -- it has been unmeasured. The mechanism is not `cancel-in-progress`, which already evaluates to false for a push. It is the concurrency group key. GitHub holds at most one in-progress and one PENDING run per group and cancels the pending one when a newer run joins, and the key was the ref -- shared by every push to main. With a mac job that queues for hours on the shared macOS pool and a merge cadence in minutes, each push cancelled the run queued behind the one in progress. Several never created a single job; one sat queued for 3h20m and was then cancelled, having reported nothing. So main gets a group per run and everything else keeps the ref key, still collapsing onto its newest push. perf.yml had the same key and the same (milder) symptom: 2 of its last 15 main runs cancelled. Checked and deliberately unchanged: release.yml is keyed per version/tag, so distinct releases never collide; site.yml's constant `publish-website` group is correct for a publish, where the latest should win and intermediate publishes should be skipped. The cost is real and is written down in docs/ci-cd.md rather than discovered: main runs no longer supersede each other, so a burst of merges is a burst of concurrent macOS jobs on a pool that has already been starved once. If the pool binds, the lever is the nine `rust <crate> (macos-15)` cells that duplicate the ubuntu ones -- not restoring the cancellation, which buys runner time by discarding the signal. The same doc now lists all three ways this gate reported success it had not earned -- swallowed failures, truncated logs, cancelled runs -- so the next person does not have to re-derive them. Implementation-Agent: claude-fable-5 (Claude Code subagent, linux-primary) Commit-Executor: claude-fable-5 (direct; Cursor usage limit) Co-authored-by: GoKubar <[email protected]>
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.
Fourth PR off the red-CI investigation (#659 evidence capture, #660 snapshot gating, #661 timing budgets). This one is the answer to why nobody noticed.
One correction up front, because it changes the fix
The suggested shape was a unique group on main plus
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}. The second half is not needed, and assuming it was the cause would have left the bug in place:cancel-in-progresswas never cancelling main. It already reads${{ github.event_name == 'pull_request' }}, which isfalsefor a push.The cancellations come from the group key instead. GitHub holds at most one in-progress and one pending run per concurrency group, and cancels the pending one whenever a newer run joins. The key was
ci-${{ github.workflow }}-${{ github.ref }}— identical for every push to main. With a mac job that queues for hours on the shared macOS pool and a merge cadence measured in minutes, every merge cancelled the run queued behind the one in progress.So the fix is to the key alone, and
cancel-in-progressis left exactly as it was.The evidence
Last 40 CI runs on
main:cancelledfailureThat single
failureis run 35022802823 — the one that exposed 35 test failures across 19 cases. It is the only run on main that has reported anything at all.Looking inside the cancelled ones:
35014851080,35011692452,35006167649— zero jobs ever created. Superseded while still pending; CI did literally nothing for those commits.35002918548— 21 jobs queued at 17:44:49, cancelled at 21:06. It held pool slots for 3h20m and reported nothing.Main's mac health was not red-and-ignored. It was never measured. #490 made a failing
swift testable to fail the job; this is why the job so rarely got to run.The change
maingets a group of its own per run; every other ref keeps the ref key and still collapses onto its newest push.perf.ymlhad the same key and the same, milder symptom — 2 of its last 15 main runs cancelled — and gets the same treatment.Checked and deliberately not changed, since you asked me to look beyond
ci.yml:release.yml— keyed per version/tag (release-<version|ref_name>) withcancel-in-progress: false. Distinct releases never share a key, so there is nothing to supersede. Correct as-is.site.yml— constantpublish-websitegroup,cancel-in-progress: false. This is the superseding behaviour, and for a publish it is right: the latest content should win and intermediate publishes should be skipped. Correct as-is.The cost, stated rather than discovered
Runs on main no longer supersede each other, so a burst of merges is a burst of concurrent macOS jobs. Each run asks for 11 macOS jobs (
mac-app,ipad, and ninerust <crate> (macos-15)cells). On a pool that has already been starved once today — 76 queued runs stalling a release for an hour — that is a material risk, and I think it is worth taking:35002918548occupied 21 job slots for 3h20m and was then cancelled. We are largely paying for these jobs today and throwing the result away.cancel-in-progress: false— is exactly the configuration that is failing now. It bounds concurrency to one, and the price is precisely the 37 cancelled runs above.If the pool does become the binding constraint, the lever to reach for is the nine
rust <crate> (macos-15)cells — ~9 of the 11 macOS jobs per run, duplicating coverage theubuntu-latestcells already provide. Dropping or scheduling those on main pushes would cut macOS demand by roughly 80% while keepingmac-appandipad, which are the jobs that can only run on macOS. I have deliberately not done that here: it is a coverage decision, it belongs in its own reviewable change, and this PR should stay a one-expression fix that is trivial to revert. Restoring the cancellation is the wrong lever — it buys runner time by discarding the signal.Documentation
docs/ci-cd.mdgains a short section recording all three distinct ways this gate reported success it had not earned, so the next person does not re-derive them:swift test | tailmeant the step's status came fromtail; no number of failures could fail the job (fixed by ci: pipefail, so a failingswift testcan actually fail the mac job #490, which immediately exposed 35).mac-swift-test-logartifact.It also records the cost and the mitigation lever above, at the point someone would look for them.
Verification
Both workflow files parse as valid YAML. The behavioural change is observable immediately after merge: runs on main stop showing
cancelledand start producing mac results — which, until #660 and #661 land, will be honestly red.Implementation-Agent: claude-fable-5 (Claude Code subagent, linux-primary)