The required check's pull-request run gives way to a newer push's, and a merge group's never is (#681 step 4, record 0206)

Closed
DO
5d ago
+143-18

Part of #681, its last step (4 of 4). Step 3 landed as #783, and the simulator's case is #800 for #749. #681 is closed once both land.

A newer push now cancels a pull request's run of the required check. A merge group's run is never cancelled. This is "CI: a newer push cancels its pull request's verify run, and a merge group's run is never cancelled" (pull request 679) brought back now that step 3 is on main: decision 0203 passes over a cancelled run's failed verify beside a later run on the same head. It carries the points of #679's Claude review, and of this change's readers.

Protected edit (.github/workflows/verify.yml): pre-approved by the Maintainer 2026-11-08, ruled by the Factory Builder 2026-11-11. The second edit to it, in 49c2695f (a re-run's group is its own run's id, from cubic's and CodeAnt's read): pre-approved by the Maintainer 2026-11-08, ruled by the Factory Builder 2026-11-13, after the push.

What

.github/workflows/verify.yml gains one top-level concurrency; its example copies match it word for word:

concurrency:
  group: ${{ format('factory-pr-{0}', github.event_name == 'pull_request' && github.run_attempt == 1 && github.event.pull_request.number || github.run_id) }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' && github.run_attempt == 1 }}
  • A pull request's run gives way to the run a newer push to the same pull request starts. On 2026-11-09, 13 of a day's 47 pull-request runs ran on after a newer push: about 870 runner-minutes, 14% of that day's pull-request runner time.
  • A merge group's run is never cancelled and cancels nothing: its group is its own run id.
  • A re-run cancels nothing and replaces nothing: past its first attempt, its group is its own run's id, as a merge group's is. In the pull request's group a re-run of an older head's run would cancel the newest head's run (Astra), or take the place of the one waiting, since a group keeps one run waiting whatever cancel-in-progress says (cubic, CodeAnt; fixed in 49c2695f).

tools/check_workflows.py:

  • Scope: lint(text, required=...) allows the two expressions in the required check's workflow alone; run() sets required for verify.yml only. In any other workflow each expression, alone too, is refused. This is the first point of #679's review.
  • The rule: RULES['expression'] names both expressions, the second point.
  • The workflow: lens_job_problems refuses any other top-level concurrency in the required check's workflow.

Record 0206 (provisional): amends decision 0014's row "A concurrency group on CI", the third point. The Factory Builder confirms its number at enqueue, after 0204 (#784) and 0205 (#776).

Held by

  • The test: tests/test_tools.py::test_only_a_superseded_pull_request_run_is_cancelled, extended so that:
    • each expression alone is refused outside the required check's workflow;
    • run() refuses the block in examples/workflows/other.yml and allows it in verify.yml.
  • Mutants: 7, each killed:
    • #679's three, two of them re-anchored;
    • "a pull request's lane stands in any workflow", "the cancel stands in any workflow";
    • "every workflow is linted as the required check's", "the required check's workflow is linted as any other".
  • Runs: 30/30 related tools/check_workflows.py mutants are killed, and tests.test_tools.Workflows passes.
  • make checks: red on one check alone. Record 0206 opens a gap until 0204 and 0205 merge; then I merge main and push.

What remains (in record 0206)

  • The secret scan's .github/workflows/ci.yml has no group, so its outdated runs run to the end; they take under a minute.
  • The group's own cancel of a run in progress, and its eviction of a waiting run, were not tried. An evicted run may start no job and leave no verify at all. P-65 cancelled by hand. Either case is of a head a newer push replaced.

Second readers

ReaderHeadResult
Carbon (Gemini 4 Carbon)05617858no findings
Muse05617858not run (hung; stopped at 40 min with no answer), owed
Astra (gpt-6-astra)056178582 majors, both fixed in c214084b: a re-run of an older head cancelled the newest head's run (now run_attempt == 1); the scoping test masked one expression behind the other (each is now tested alone)
Claude + security05617858no blocker. 1 major, fixed: nothing held run()'s scoping to verify.yml (test and mutant added). 2 minors, fixed in record 0206: a re-run from an older head, and the group's cancel and eviction not tried

The fixes in c214084b came after the readers; none of them re-read that head.

šŸ¤– Generated with Claude Code