-
Notifications
You must be signed in to change notification settings - Fork 0
Document NFS-safe Cargo builds: use local CARGO_TARGET_DIR before disabling parallelism #8
Description
Summary
When a repository is checked out on an NFS-mounted workspace or worktree, parallel cargo builds can become flaky in ways that look like toolchain bugs: missing object files during link, zero-length archives, undefined symbol: main from build scripts, linker Bus error, etc.
The base agent guidance should document this explicitly and recommend the right mitigation:
- do not immediately fall back to serialized builds as the default answer
- instead, set
CARGO_TARGET_DIRto a path on local disk (for example/tmp/<repo>-targetor another non-NFS cache path) - then keep normal parallel compilation enabled
- for local test execution, prefer parallel runners such as
cargo nextestwhen available instead of regressing to serializedcargo test
Motivation
I hit this on tenferro-rs on 2026-03-09 while working from an NFS-backed worktree. The failures went away once the build artifacts were moved to local disk via CARGO_TARGET_DIR.
That is a generally useful rule for agent workflows, because many users work in network-mounted home directories or shared lab filesystems.
Proposed doc change
Please add a note to the base guidance (root AGENTS.md, and probably the shared rules under ai/vendor/template-rs/) along these lines:
If the repository lives on NFS or another network-mounted filesystem and parallel
cargobuilds become unstable, move build artifacts to local disk withCARGO_TARGET_DIRfirst. Prefer keeping parallel builds enabled once the target directory is on local storage. For local test runs, prefer parallel runners such ascargo nextestwhen available.
It would also help to mention that multiple concurrent cargo invocations should avoid fighting over the same target directory unless that is intentional.
Why this matters
Without this guidance, agents may converge on the wrong workaround (CARGO_BUILD_JOBS=1 everywhere), which is slower than necessary and treats the symptom rather than the main cause.