ci: cancel superseded runs on the five unguarded workflows - #435
Conversation
MistKit.yml, MistDemo.yml, and the two Example workflows already cancel a PR's older runs when a new commit lands. Five workflows had no concurrency block at all, so every re-push left the previous run alive and holding a runner until it finished on its own. codeql.yml was the expensive one. Its push trigger is branches-ignore: ['*WIP'], so it fires on every push to every branch, and its Swift analysis runs on macos-26 — the scarcest runner class. A branch pushed three times held three macOS runners. swift-source-compat.yml (three ubuntu container jobs, unfiltered pull_request) and claude-code-review.yml (every synchronize) had the same problem at lower cost. check-unsafe-flags.yml and examples.yml only fire on main-targeting PRs, so they stacked more rarely, but the gap was the same. All five get the branch-keyed group the rest of the repo already uses. codeql.yml additionally keys on event_name so its weekly scheduled scan and a push scan of the same branch land in separate groups and cannot cancel each other; within a single event type, only the newest run of a branch survives. No trigger filters change, so nothing that was being built, tested, or scanned stops being built, tested, or scanned. The only behavior change is that a superseded run now stops instead of running to completion. Deliberately left alone: MistDemo-Integration.yml keeps cancel-in-progress: false. It fires only on pushes to main and v*.*.*, never on PRs, so it cannot stack per-PR, and killing it mid-run would leave stray records in the live CloudKit container. Also not addressed here: codeql.yml double-fires on main-targeting PRs, once via push and once via pull_request, so those commits still get two macOS runs. Scoping push to main would fix it, but its pull_request filter is branches: ['main'], so PRs targeting any other base would then get no CodeQL coverage at all. That is a coverage decision, not a cost one, and is left for a separate discussion. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvtV3mTRRLqC7Xnqhaim92
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v1.0.0-beta.4 #435 +/- ##
================================================
Coverage ? 74.52%
================================================
Files ? 158
Lines ? 3761
Branches ? 0
================================================
Hits ? 2803
Misses ? 958
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Makes every PR-driven workflow run only on a PR's latest commit. Five workflows had no
concurrencyblock at all, so each re-push left the previous run alive and holding a runner until it finished on its own.What was piling up
codeql.ymlbranches-ignore: ['*WIP'])macos-26— the scarcest runner classswift-source-compat.ymlclaude-code-review.ymlsynchronizecheck-unsafe-flags.ymlexamples.ymlCodeQL was the expensive one: a branch pushed three times held three macOS runners, none of which could be superseded.
MistKit.yml,MistDemo.yml,BushelCloud.yml, andCelestraCloud.ymlalready cancelled correctly and are untouched.The change
All five get the branch-keyed group the rest of the repo already uses:
codeql.ymladditionally keys ongithub.event_name, so its weekly scheduled scan and a push scan of the same branch land in separate groups and cannot cancel each other. Within a single event type, only the newest run of a branch survives.No trigger filters change. Nothing that was being built, tested, or scanned stops being built, tested, or scanned — the only behavior change is that a superseded run now stops instead of running to completion.
Deliberately left alone
MistDemo-Integration.ymlkeepscancel-in-progress: false. It fires only on pushes tomainandv*.*.*, never on PRs, so it cannot stack per-PR — and killing it mid-run would leave stray records in the live CloudKit container.CodeQL's double-fire is not addressed here. On main-targeting PRs it runs twice per commit, once via
pushand once viapull_request, so those commits still consume two macOS runners. Scopingpushtomainwould fix it — but itspull_requestfilter isbranches: ['main'], so PRs targeting any other base (av1.0.0-beta.*branch, for instance) would then get no CodeQL coverage at all. That is a coverage decision rather than a cost one, so it's left for a separate discussion.Verification
Enumerated every workflow's triggers and concurrency config before and after. Before: five workflows reported "no concurrency — piles up." After: every PR-driven workflow reports
cancel-in-progress: true, withMistDemo-Integration.ymlthe only remainingfalse(deliberate, per above). All 10 root workflow files parse as YAML.The real proof is behavioral: push twice in quick succession to a PR branch and confirm the first CodeQL run is cancelled rather than left running.