CI: a newer push cancels its pull request's verify run, and a merge group's run is never cancelled

Closed
DO
9d ago
+60-2

A newer push to a pull request now cancels that pull request's factory run. A merge group's run is never cancelled and never cancels another run.

Why. Over the 24 hours to 2026-11-09 13:40Z, the 47 pull-request runs of factory used 6,409 runner-minutes, 62% of all of the repo's runs, on the Free plan's 20 concurrent runners. 13 of those runs carried on after a newer push to the same pull request had started a run of its own. Their work after that point was about 870 runner-minutes, 14% of the pull-request total. This doesn't touch the merge-queue bursts: those are handled by the 75-minute timeout in #678.

The change (.github/workflows/verify.yml, its example, and the standard's copy):

concurrency:
  group: ${{ format('factory-pr-{0}', github.event.pull_request.number || github.run_id) }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
  • On pull_request, the group is factory-pr-<number> with cancel-in-progress on, so a newer push cancels the older run.
  • On merge_group, the group is factory-pr-<run id>, which no other run shares, and cancel-in-progress is off, so the run cancels nothing and nothing can cancel it.
  • The prefix keeps these groups apart from every Run's lane, whose group is its item (${{ inputs.item }}).
  • When a run is cancelled, its verify job still runs under if: always() and fails that run. That run belongs to the older head, which the pull request no longer has.

What holds it (tools/check_workflows.py):

  • The expression rule allows exactly these two values at a workflow's top-level concurrency, and no other expression there.
  • The required check's workflow may have no concurrency, or exactly this block. A single shared group, or cancel-in-progress: true, would let one merge group's run cancel another's and eject its entries, so either is refused.
  • Held by test_only_a_superseded_pull_request_run_is_cancelled, with three mutants. A filtered run killed them, though only after the named_test_does_not_kill guard from #666 caught a fourth mutant of a redundant clause; the clause is gone.

Verification: make checks passes. The Workflows, Verify, release-workflow and eval test classes pass (152 tests). A make verify on an export of the head is running, and CI is the full check.

Protected edits (.github/workflows/verify.yml, tools/check_workflows.py): pre-approved by the Maintainer 2026-11-08, ruled by the Factory Builder 2026-11-09. Labelled factory:hands-off.

šŸ¤– Generated with Claude Code