You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rust.sh shares one CARGO_TARGET_DIR across worktrees, so a scratch-copy build poisons the next run #906
scripts/rust.sh runs every build in one container with CARGO_TARGET_DIR=/target and the source mounted at /work/nostream. A build of a scratch copy of the tree — the shape a reviewer uses to prove a fix by reverting it — writes into that same target directory, and the next worktree run then reads artifacts keyed to the scratch path.
Measured during the 4.0 rewrite (006-nostream-core, round 3): a revert build followed by the worktree suite gave 51 passed / 2 failed; touch-ing the affected sources and re-running gave 53 passed / 0 failed, with no source change. The failures were stale artifacts, not defects.
Two candidate fixes:
Isolate the target for a scratch run: pass CARGO_TARGET_DIR=/target-$(basename "$PWD") (or a caller-supplied CARGO_TARGET_DIR) instead of a single shared /target.
Keep the shared target and document the requirement in the script header: after building anything outside the job worktree, touch the sources before the next worktree run.
(2) is a one-line comment; (1) costs a cold build per distinct path but removes the trap. The reviewer that hit it lost one round-trip and nearly reported a regression that did not exist.
scripts/rust.sh now derives the target directory from the checkout path — /target-<basename>-<cksum>, mounted from the same key under RUST_CACHE_HOST — so two trees no longer share fingerprints. CARGO_TARGET_DIR still overrides (absolute only; relative exits 64), and RUST_CACHE_VISIBLE names the client-side spelling when the cache root is not visible from the calling shell, in which case a daemon-only root is warned about and left to the daemon rather than refused.
Measured on a scratch copy with run_transaction reverted: the old script's worktree ran the scratch binary with no Compiling line and failed op 117 (transaction) differs from the TypeScript capture; touch then cleared it. With the fix the two runs wrote target-scratch-906-562595450 and target-906-rust-target-53259279 and neither read the other. Cost: one cold build per checkout, 36 s for cargo test --workspace --all-features --no-run, 21 s for cargo check -p nostream-storage on a second path.
The same pattern still exists outside this repository in containers/rust-builder/rb-run; filed separately as cameri/phoenix-server#48, since it cannot be fixed here.
Activity
chappie-daemon commentedon Oct 20, 2026
Fixed by #914, merged as
6ef609a.scripts/rust.shnow derives the target directory from the checkout path —/target-<basename>-<cksum>, mounted from the same key underRUST_CACHE_HOST— so two trees no longer share fingerprints.CARGO_TARGET_DIRstill overrides (absolute only; relative exits 64), andRUST_CACHE_VISIBLEnames the client-side spelling when the cache root is not visible from the calling shell, in which case a daemon-only root is warned about and left to the daemon rather than refused.Measured on a scratch copy with
run_transactionreverted: the old script's worktree ran the scratch binary with noCompilingline and failedop 117 (transaction) differs from the TypeScript capture;touchthen cleared it. With the fix the two runs wrotetarget-scratch-906-562595450andtarget-906-rust-target-53259279and neither read the other. Cost: one cold build per checkout, 36 s forcargo test --workspace --all-features --no-run, 21 s forcargo check -p nostream-storageon a second path.The same pattern still exists outside this repository in
containers/rust-builder/rb-run; filed separately as cameri/phoenix-server#48, since it cannot be fixed here.