pub fn build_cache_note(node: &str, allow_write: bool) -> StringExpand description
What a seat is told about the shared build cache — one of two notes, chosen by whether the seat may write at all.
Spliced into every node prompt (in [crate::graph::wave] and
crate::graph::Runner::synthesize_brief) when the run’s config declares
a CARGO_TARGET_DIR — which is also the directory the verify commands
build into. The text is stable so tests can assert on it; the value of the
variable is not spelled out because a write-allowed seat reads it from its
own environment, and a prompt that hardcodes a path would go stale the
moment the config moves the cache.
allow_write must agree with whether the caller actually hands the seat
CARGO_TARGET_DIR (see crate::agent::Invocation::cache_dir) — a
read-only seat that is still told “build through it” is exactly how a
sandboxed reviewer’s write refusal to a directory it was never meant to
touch got reported as a defect in the patch under review. So a read-only
seat is told plainly that it has no shared cache and that a write refusal
anywhere outside its own worktree is expected, not evidence of anything.
The fund-transfer reality the write-allowed note exists to prevent: an
implementer that builds with its own CARGO_TARGET_DIR (or lets cargo
create a fresh target/ in the worktree) is compiling a second copy of
the world that nobody prunes, on a machine that has already had that exact
failure once. It also spells out the one thing a test name filter cannot
do — cargo test report:: still compiles every integration target in the
workspace, because the filter selects which tests run, not which
targets get built — so a seat asked for a narrow check knows to reach
for --lib/--test instead of assuming a filter alone bounds the build.
node is the graph node this is spliced into ("review", "fix", …).
A reviewer or fixer gets an extra paragraph saying full verification is
magi’s own job, not theirs to repeat — the same duplicated-full-suite cost
neither note’s own advice does anything to prevent on its own, since a
seat that dutifully stays inside its own worktree can still spend the
round re-running the whole suite there. Phrased as a request, not a
guarantee: magi has no way to stop a seat from running cargo test --all-targets anyway, so the note asks rather than claims it enforces
anything.