Repository navigation
perf(cargo): checks run under the target lock, and the lock rebuilds only after another worktree built - #314
Conversation
…only after another worktree built
|
bstack-judge: FAIL tier=2 blocking=1 sha=56a2e7fa0f537915ecb8401b935fbef477f82d1b Blocking: F1. PR 314 judged at head 56a2e7f. The PR closes no issue, so I took its Request and "What changed" as the contract. Checks are green: ubuntu, windows, validate. risk-tier puts it at tier 2 ( Criteria and proof
Findings Reproduction on fixtures: two copies of one crate, A returning "ok" and B returning "broken", with the same package name and a lib unit test asserting "ok". B's lib is large and B runs with
This is the scenario the PR is built for: many agents sharing one target dir, where one runs the app while another tests. A run's verdict can then come from the other worktree's code. A possible fix: the unlocked Dropped hypotheses
The overlap reproduction is the script [{"id":"F1","title":"cargo run writes .bstack-cargo.last without the lock, so a concurrent locked build by another worktree leaves the record naming this worktree and its next cargo test skips marking and runs the other worktree's test binary","reproduction":"node --test tests/cargo-lock.test.mjs fixture variant: worktree B `cargo test -j1` (slow lib) via plugins/bstack/scripts/cargo-lock.mjs, after 3 s worktree A `cargo run` via the wrapper, then A `cargo test` via the wrapper: head exits 101 left: \"broken\", base exits 0","base":"pass","head":"fail","blocks":"regression","files":["plugins/bstack/scripts/cargo-lock.mjs"]}] |
|
bstack-judge: PASS+NOTES tier=2 sha=02b6d16ca51114f238dcb2f6e112a12d02fd53ca Fixed: F1. PR 314: judge of the delta 56a2e7f..02b6d16 (head 02b6d16, checked out detached)What the delta does: F1 (posted):
Attack hypotheses on the delta
Notes (not blocking)
Cleanup: [{"id":"F1","title":"cargo run writes .bstack-cargo.last without the lock, so a concurrent locked build by another worktree leaves the record naming this worktree and its next cargo test skips marking and runs the other worktree's test binary","reproduction":"node --test --test-name-pattern=\"leaves no last builder\" tests/cargo-lock.test.mjs (fails with 56a2e7f plugins/bstack/scripts/cargo-lock.mjs, passes on head); posted multi-worktree timing variant did not reproduce on 56a2e7f or head here","base":"pass","head":"pass","blocks":"no","files":["plugins/bstack/scripts/cargo-lock.mjs"]}] |
Request: "implementer nu alle dine anbefalinger effektivt i bstack. skip gerne verificeringer osv så vi kan pushe denne opdatering hurtigst muligt, og jeg ønsker at trykke merge til sidst"
Why: one 17.7 hour run with 39 agents on a Rust repo sharing
CARGO_TARGET_DIRspent about 60 % of agent time waiting on cargo, and about half its tokens re-reading whole contexts after waits over five minutes. 13 of 44 heads got both a failed and a passedbstack/checkson the same commit.What changed
checks.mjsruns everycargoline of the checks file throughcargo-lock.mjs, so the gate no longer tests a build another worktree left in the shared target dir.cargo-lock.mjsmarks the workspace sources as changed only when another worktree built into the target dir last (.bstack-cargo.lastholds the last workspace root). Back-to-back runs in one worktree no longer rebuild everything.cargo-lock.mjstakes no lock and marks nothing for commands that build nothing (fmt,machete,metadata,tree,fetch,update,audit,deny).CARGO_TARGET_DIRis set, so an agent does not learn it from a guard stop.checks.mjs; waits over five minutes run in the background and are polled in sleeps of at most 240 s.bstack/checkson the head covers the full suite; the same waiting rule.Scope: no machine cargo config (
jobs, linker) and nothing in the repos that use bstack.Tradeoffs: the plugin markdown budget in
tools/check-plugin.mjsgoes from 64169 to 64848 bytes, the size of the new instruction lines after trimming them; nothing was subtracted elsewhere.Verification:
node --test tests/cargo-lock.test.mjs tests/checks.test.mjs: pass 31, fail 0, with a new real-cargo test for the marking rule and one for the wrapped checks command.check-plugin,comment-ratchet,handback,judgetests: pass 70, fail 0. The full suite and a run on a real multi-agent Rust task were not run, at the user's request.