Repository navigation
ci: scope the concurrency group by event so a push run is never cancelled by its PR run - #623
Merged
Merged
Conversation
…lled by its PR run The group was keyed on the source branch alone, so the pull_request run cancelled the push run on the same head SHA. The cancelled run kept the same four job names, and the ruleset's required checks counted those cancelled contexts: PR #621 stayed BLOCKED with all four checks green until the cancelled push run was deleted by hand. Keying the group on the event as well means cancellation only happens within one event, where it always means a newer SHA on the same ref. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
Since #620 (0c483f7) the CI concurrency group was
ci-${{ github.head_ref || github.ref_name }}, shared by a branch's push run and the pull_request run it leads to. The PR run cancelled the push run, the cancelled run stayed on the same head SHA with the same four job names, and the rulesetmain: required checks before mergecounted those cancelled contexts. PR #621 (head 075e950) sat BLOCKED with all four checks green until the cancelled push run 45826920718 was deleted by hand.What
.github/workflows/ci.ymlonly:cancel-in-progress(never on main) and thepaths-ignorefrom #620 are unchanged; thepushtrigger stays. Cancellation now happens only within one event, where a cancel always means a newer SHA on the same ref (a newer push, or a newer PR head) — so a cancelled run can never be the only result on a PR's head. That supersession is the dedupe that remains.Cost, measured on this repo's runs
For a branch that pushes once and then opens a PR, the number of runs created is 2 either way:
chore/ci-one-run-per-branch@14a24565: push 45822150258 cancelled after 7–9 s per job; PR 45822170901. Same on dev: load-question-bank.mjs — idempotent loader for the Cutting MTU 500-question bank #621.actions/runs?head_sha=…total_count 2).phamtruonghung-questionbank@35e5a00b push 45820086101 + PR 45820113538, both success.So the extra cost against #620 is the rest of the push run that used to be cancelled: on this PR the push run 45832310327 took 858 job-seconds (frontend 688 s, backend 128 s, images 17 s + 25 s) ≈ 14 runner-minutes, once per branch that is pushed before its PR opens. The dedupe that remains is supersession within one event: repeated pushes to a branch, or repeated heads of a PR, still collapse to the newest run.
Evidence
gh pr view 623 --json mergeStateStatus,statusCheckRollup→CLEAN, 8/8 contextsSUCCESS(four names × push + pull_request), no run deleted.probe/ci-event-scoped(8 s apart): push run 45832504099 @c547c683cancelled, push run 45832531336 @81e0c8bcin_progress(cancelled by hand afterwards to save minutes; branch deleted). This PR's head was unaffected.