Skip to content

ci: cancel a PR's superseded test run when its head moves (#848) - #933

Merged
fujibee merged 1 commit into
mainfrom
ci/cancel-superseded-pr-runs
Aug 21, 2026
Merged

ci: cancel a PR's superseded test run when its head moves (#848)#933
fujibee merged 1 commit into
mainfrom
ci/cancel-superseded-pr-runs

Conversation

@fujibee

@fujibee fujibee commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Part of #848 — the part that costs nothing. Twelve lines of tests.yml: a concurrency group keyed by PR number, with cancel-in-progress for pull_request events only.

Why this, and why today's numbers say so

Measured on 2026-08-21 from the tests workflow's job timestamps (the full table, with the other directions and what each does and does not fix, is on #848):

  • 35 tests runs were created that day — 28 pull_request, 7 push — each with four macOS shards: 140 macOS jobs, averaging ~13 min.
  • The most macOS jobs ever observed running at once was 5. That is the account's runner ceiling, and it turns 140 jobs into roughly six hours of serialized macOS time.
  • It shows up as queue wait, not runtime: macOS shards waited 0–50 min to start; one PR's shard 3/4 waited 50 min; at 20:40Z three main runs created after 19:18Z had not started a macOS job yet.
  • Several of those runs were superseded: the same PR's head moved two or three times during review, another was rebased — and each superseded run kept its four slots until it finished. Nothing cancels them, because tests.yml has no concurrency: group.
  • The shard cap (ci: macOS shard runtime has outgrown the 25-minute cap — adding tests can re-pack a shard over the cliff (wall-clock cancel of a passing shard, not a hang) #848's original subject) is not what bit: it is 30 min since fix(watch): fold sentinel '-' into the empty session-id path #857, and the heaviest macOS shard ran 22–25 min all week; the three test files added that day cost seconds.

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

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant