ci: cancel a PR's superseded test run when its head moves (#848) - #933
Merged
Conversation
A pull_request run whose head has been replaced can be used for nothing -- not a verdict, not a gate -- and it keeps its four macOS shards until it finishes. The account runs at most five macOS jobs at once (measured 2026-08-21: 35 runs, 140 macOS jobs, start waits of 0-50 min; one PR's shard waited 50 min behind runs whose heads had already moved). A concurrency group keyed by PR number with cancel-in-progress frees those slots the moment a new head arrives. A push to main is never cancelled: its group is its own run id, and a release reads that run.
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.
Part of #848 — the part that costs nothing. Twelve lines of
tests.yml: aconcurrencygroup keyed by PR number, withcancel-in-progressforpull_requestevents only.Why this, and why today's numbers say so
Measured on 2026-08-21 from the
testsworkflow's job timestamps (the full table, with the other directions and what each does and does not fix, is on #848):testsruns were created that day — 28pull_request, 7push— each with four macOS shards: 140 macOS jobs, averaging ~13 min.mainruns created after 19:18Z had not started a macOS job yet.tests.ymlhas noconcurrency:group.A run whose head has moved cannot be used for anything — not a review verdict (those name the head), not the merge gate — so cancelling it loses nothing and frees four macOS lanes out of five.
What it does not do
pushruns. Their group istests-<run id>, one run per group, so a push tomainalways runs to completion; that run is what a release reads.main) would have hidden the day's most useful failure (The SQL quote helper is wrong on bash 3.2, and its only caller is skipped on the platform where it breaks #928) until after merge.No before/after measurement is possible for this one — the effect is on the next batch of concurrent PRs — which is why the numbers above are the justification rather than a result.