chore(gates): queue behind other heavy builds on the host, not race them - #455
Merged
Merged
Conversation
Nothing coordinates two heavy cargo runs on one machine. On 2026-09-25 this repo's gate was OOM-killed three times while another project's `cargo test --workspace` (OpenPulseHF) ran alongside it, and each kill looked like a failure of the code under test. `scripts/host-build-lock.sh` takes a HOST-WIDE flock, held until the calling script exits. `scripts/check-all.sh` and `.githooks/pre-push` each source it once, near the top. The path is shared with OpenPulseHF's `scripts/lib/host-build-lock.sh` (dc0sk/OpenPulseHF#1440), so the two projects' gates queue instead of contending for RAM. `HEAVY_BUILD_LOCK` overrides it, and every project must agree on the value. One helper, sourced by both, rather than the snippet pasted twice — two copies of one decision drifting apart is this repo's dominant defect class. Deadlock rules, stated in the helper: a script takes the lock once; nothing it calls takes it again (pre-push does not call check-all.sh); and nobody wraps a locking script in `flock` by hand, since the inner take would wait forever on the lock the outer one holds. Verified against the real helper: with the lock held by another process, a second take printed "waiting for it to finish" and acquired it 3.5 s later, exactly when the holder released; uncontended, it acquired in 0.01 s. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018p7FxX7QMWNJVNp9LbaLkB
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
Nothing coordinates two heavy cargo runs on one machine. On 2026-09-25 this repo's gate was OOM-killed three times while another project's
cargo test --workspace(OpenPulseHF) was running at the same time. Each kill looked like a failure of the code under test.What
scripts/host-build-lock.shtakes a host-wideflockand holds it until the calling script exits.scripts/check-all.shand.githooks/pre-pusheach source it once, near the top.The lock path is shared with OpenPulseHF's
scripts/lib/host-build-lock.sh(dc0sk/OpenPulseHF#1440), so the two projects' gates queue instead of competing for RAM.HEAVY_BUILD_LOCKoverrides the path, and every project has to use the same value.There's one helper, sourced by both scripts. Pasting the snippet into each would create two copies of the same decision that can drift apart, which is this repo's most common defect.
Deadlock rules (stated in the helper):
pre-pushdoes not callcheck-all.sh.flockby hand. The inner take would wait forever on the lock the outer one already holds.Verification
Context
The same session also:
code-quality-gatesskill's pre-push template.🤖 Generated with Claude Code
https://claude.ai/code/session_018p7FxX7QMWNJVNp9LbaLkB