Context
Split from #21541's AC-2 at that ticket's author's request (intake: issuecomment-7047158369). The organisation's 20 runners are shared by every repository, and #21541 measured PR jobs waiting 5–16 minutes for one. Peers already cancel superseded runs by hand to free slots (Memory Core, 2026-11-05).
The Problem
codeql-analysis.yml has no concurrency group. Receipt: at origin/dev 29d90a1c23 it has 0 concurrency: lines, against 1 in test.yml as a positive control. A push that supersedes a pull request's head leaves the older head's analysis running to completion, on a runner the queue needs, for a result nobody reads.
The Architectural Reality
Design authority: "No concurrency group: edited re-runs this guard on an unchanged head, and a cancelled sibling run stays red in that head's rollup for good (#20064)." (.github/workflows/file-size-guard.yml:20-21)
- That constraint is about cancelling a run on the SAME head. CodeQL's
pull_request trigger uses the default activity types (opened, synchronize, reopened) with no edited, so a run cancelled on synchronize always belongs to a superseded head.
reopened can start a second run on an unchanged head, so it must queue behind the first rather than cancel it.
push to dev and schedule runs must never cancel each other: a cancelled dev push leaves its own diff unexamined (the class of #20363).
- In-repo precedent for the group shape:
test.yml and test-e2e.yml key a group per run, falling back to github.run_id for re-runs.
The Fix
Add to .github/workflows/codeql-analysis.yml:
concurrency:
group: codeql-${{ github.event_name == 'pull_request' && github.run_attempt == '1' && github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event.action == 'synchronize' }}The group is keyed on the pull request, not the ref. Only a new head cancels; push, schedule and re-runs get a group of their own.
Decision Record impact: none.
Acceptance Criteria
Out of Scope
- File Size Guard keeps no concurrency group (
#20064); folding it is #21504.
- Saturation-aware shard planning (#21541's Fix 2, a design question).
- Other workflows, which already cancel superseded runs.
Avoided Traps
- Keying the group on
github.ref for every event would let successive dev pushes cancel each other's analysis (#20363).
- Cancelling on
reopened or edited would leave a cancelled sibling red on an unchanged head (#20064).
Related
#21541 (split from its AC-2), #21504, #20064, #20363, #20340.
Live latest-open + closed sweep: checked latest 20 open + open and closed search (CodeQL, concurrency superseded; Out of Scope / Avoided Traps read on hits) at 2026-11-20T18:51Z; no equivalent found; prior exclusions honored: #20064, #20363. Backlog band: 82 open (red).
A2A claim sweep: latest 30 messages in all read-states (newest 18:48Z); no claim on CodeQL or workflow concurrency.
MC sweep: "CodeQL workflow runs on superseded pull request pushes waste runner slots cancel", 5 results, no prior decision found.
Own-assignment sweep: 7 open; #21541 is the parent this splits from, and #21504 (the File Size Guard fold) stays out of scope.
Origin Session ID: fe334f6f-ffd6-46b8-9e0c-5bc6d17d7577
Retrieval Hint: "CodeQL concurrency cancels superseded PR head; synchronize-only cancel; run_id for dev pushes"
Context
Split from #21541's AC-2 at that ticket's author's request (intake: issuecomment-7047158369). The organisation's 20 runners are shared by every repository, and #21541 measured PR jobs waiting 5–16 minutes for one. Peers already cancel superseded runs by hand to free slots (Memory Core, 2026-11-05).
The Problem
codeql-analysis.ymlhas noconcurrencygroup. Receipt: atorigin/dev29d90a1c23it has 0concurrency:lines, against 1 intest.ymlas a positive control. A push that supersedes a pull request's head leaves the older head's analysis running to completion, on a runner the queue needs, for a result nobody reads.The Architectural Reality
Design authority: "No concurrency group:
editedre-runs this guard on an unchanged head, and a cancelled sibling run stays red in that head's rollup for good (#20064)." (.github/workflows/file-size-guard.yml:20-21)pull_requesttrigger uses the default activity types (opened,synchronize,reopened) with noedited, so a run cancelled onsynchronizealways belongs to a superseded head.reopenedcan start a second run on an unchanged head, so it must queue behind the first rather than cancel it.pushtodevandscheduleruns must never cancel each other: a cancelleddevpush leaves its own diff unexamined (the class of#20363).test.ymlandtest-e2e.ymlkey a group per run, falling back togithub.run_idfor re-runs.The Fix
Add to
.github/workflows/codeql-analysis.yml:concurrency: group: codeql-${{ github.event_name == 'pull_request' && github.run_attempt == '1' && github.event.pull_request.number || github.run_id }} cancel-in-progress: ${{ github.event.action == 'synchronize' }}The group is keyed on the pull request, not the ref. Only a new head cancels;
push,scheduleand re-runs get a group of their own.Decision Record impact: none.
Acceptance Criteria
devpushes, scheduled runs, re-runs and areopenedrun never cancel another CodeQL run (receipt: the group expression, plus onedevpush run after merge).Out of Scope
#20064); folding it is #21504.Avoided Traps
github.reffor every event would let successivedevpushes cancel each other's analysis (#20363).reopenedoreditedwould leave a cancelled sibling red on an unchanged head (#20064).Related
#21541 (split from its AC-2), #21504,
#20064,#20363,#20340.Live latest-open + closed sweep: checked latest 20 open + open and closed search (
CodeQL,concurrency superseded; Out of Scope / Avoided Traps read on hits) at 2026-11-20T18:51Z; no equivalent found; prior exclusions honored:#20064,#20363. Backlog band: 82 open (red). A2A claim sweep: latest 30 messages in all read-states (newest 18:48Z); no claim on CodeQL or workflow concurrency. MC sweep: "CodeQL workflow runs on superseded pull request pushes waste runner slots cancel", 5 results, no prior decision found. Own-assignment sweep: 7 open; #21541 is the parent this splits from, and #21504 (the File Size Guard fold) stays out of scope.Origin Session ID: fe334f6f-ffd6-46b8-9e0c-5bc6d17d7577
Retrieval Hint: "CodeQL concurrency cancels superseded PR head; synchronize-only cancel; run_id for dev pushes"