fix: add concurrency control to nix-hashes workflow#18228
Open
jerome-benoit wants to merge 2 commits intoanomalyco:devfrom
Open
fix: add concurrency control to nix-hashes workflow#18228jerome-benoit wants to merge 2 commits intoanomalyco:devfrom
jerome-benoit wants to merge 2 commits intoanomalyco:devfrom
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds workflow-level concurrency to the nix-hashes GitHub Actions workflow so only the latest run per branch (dev/beta) proceeds, preventing stale nix/hashes.json commits caused by overlapping runs.
Changes:
- Introduces a workflow-level
concurrencygroup keyed by${{ github.workflow }}-${{ github.ref }}. - Enables
cancel-in-progress: trueso older runs are cancelled when a newer run starts on the same ref.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
5 tasks
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.
Issue for this PR
Closes #18227
Type of change
What does this PR do?
Adds a workflow-level
concurrencygroup withcancel-in-progress: trueto thenix-hashesworkflow to prevent a race condition where two concurrent runs can overwrite each other's hashes.The problem: When two pushes happen in quick succession (e.g. two commits within 2 minutes that both modify
bun.lockorpackage.json), both trigger anix-hashesrun. The 4 matrixcompute-hashjobs run at different speeds across platforms (darwin runners are significantly slower than linux). Theupdate-hashesjob that finishes last commits its hashes — which is not necessarily from the most recent commit.Concrete evidence from 2026-03-18: Run 1 (SHA
81be5449, triggered 23:52) and Run 2 (SHA5d2f8d77, triggered 23:54) ran concurrently. Run 2'supdate-hashescompleted at 00:07:35, but Run 1'supdate-hashescompleted at 00:08:33 — overwriting Run 2's correct hashes with stale ones from an older commit. This leftx86_64-linuxwith hashsha256-yfA50QKqylmaioxi+6d++W8Xv4Wix1hl3hEF6Zz7Ue0=when the correct value issha256-b0IXNtTj5geRLZGtCI5DxOXyqBJoxuwVf++bUgY3dco=.The fix:
concurrency.cancel-in-progress: trueat workflow level cancels the entire older run (matrix jobs + update-hashes) when a newer push triggers the workflow. Combined with the existinggit pull --rebasedefense in the commit step, this eliminates the race condition. Workflow-level (not job-level) concurrency is used because job-level onupdate-hashesalone would still allow stale matrix results to queue up.How did you verify your code works?
cancel-in-progresssends SIGINT to all running jobs, andneeds:dependency preventsupdate-hashesfrom starting ifcompute-hashis cancelledconcurrency.groupusesgithub.workflow+github.refsodevandbetaruns don't cancel each otherworkflow_dispatchtriggers are also covered by the concurrency group (same workflow name + ref)Screenshots / recordings
N/A — CI workflow change only.
Checklist