Cancel a PR's superseded Build Test Distribute runs - #6742
Merged
Conversation
Two runs of fedr/ubuntu26-target were live at once (my push, then a second one 2 minutes later) and both reached the point of pushing the brand-new meshlib/meshlib-ubuntu26 image. The winner created the repository and pushed with zero retries; the loser, starting 52 s later while that push was still in flight, was denied on its very first blob POST and died with `unauthorized: authentication required` after 15 s of retries. Concurrent pushes of the same tag to an *existing* repo succeeded in the same two runs, so it is implicit repo creation that is not concurrency-safe, not the token. Nothing here should serialize a release, so only pull_request runs share a group and only they are cancellable; every other event keys the group on run_id, which is unique per run.
adalisk-emikhaylov
approved these changes
Sep 1, 2026
Grantim
approved these changes
Sep 1, 2026
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
build-test-distribute.ymlhas noconcurrency:group, so pushing to a PR branch leaves the previous run alive alongside the new one. On #6738 that turned into a real failure rather than just wasted minutes.Two runs of
fedr/ubuntu26-targetwere live at once — my commit, then a second push two minutes later — and both reached the point of pushing the brand-newmeshlib/meshlib-ubuntu26image:Pushed@ 09:24:46Retrying in 5 seconds@ 09:25:36unauthorized@ 09:25:51The loser was denied on its very first blob POST, 52 s after the winner started and while the winner was still uploading. The token is not the problem — the winner created that repository from nothing with zero retries, and as a control both runs pushed the identical tag
source-checksum-f4e25eb26edf59efto the existingmeshlib-ubuntu24repo over overlapping windows (09:22:01→09:24:22 and 09:24:01→09:26:22) and both succeeded. Existing repo plus concurrent same-tag push is fine; a repository that does not exist yet is created as part of the first push, and a second session asking for push scope on that same path while creation is in flight getsunauthorized.docker pushretries only ~15 s, so the loser dies.What
Only
pull_requestruns share a group, and only they are cancellable. Every other event (pushto master,schedule,workflow_dispatch) keys the group ongithub.run_id, which is unique per run — so a release run is never cancelled by the next push, and equally never sits queued behind the previous one. Keying those ongithub.refinstead would have serialized consecutive master pushes behind a 1–2 h pipeline, which is worse than the race it fixes.Cancelling mid-image-push is safe: the manifest is written last, so a cancelled push leaves only orphan blobs and the next run re-pushes the tag.
Verification
I will push a second commit to this branch on purpose and confirm the first run ends up
cancelledrather than racing — that is the only way to exercise this end to end, and I will report the result in a comment.Notes
Labels disable the platforms this cannot affect; no
upload-binaries, since nothing here needs a published release.