---
name: a-driver-edited-midrun-mangles-into-vacuous-green
description: "A rig script rewritten while bash is executing it resumes mid-line and silently drops env, producing green vacuous PASSes; check script mtime against the run window before bisecting env."
metadata: 
  node_type: memory
  type: feedback
  originSessionId: 8743ae34-c548-4eef-a2cd-cc839bf4b478
  modified: 2026-09-07T11:18:00.037Z
---

**bash reads a script incrementally by byte OFFSET, not as a slurped whole.** Rewriting the file
in place under a running shell shifts every later byte, so the shell resumes at its saved offset
and executes text nobody ever wrote. The damage does NOT present as a syntax error.

MEASURED 2026-09-07 (W2 F17, xbox twohost pair): doyle rewrote
`.worktrees/gate-w2-401a19ad/.spt/twohost-web-xbox.sh` at 11:00:08Z (and `mutate.py` at 11:00:02Z)
while my run out of that tree held 10:58:07Z -> 11:07:09Z. The mangled line was role A's env
prefix, so `cargo nextest run` launched with no `SPT_TWO_HOST` -> `Rig::from_env`
(`twohost_web.rs:126`) returned None -> **all five cells "passed" doing nothing.**

**The detector — uniform ~0.0x s PASS across an arm that must do network work, INCLUDING the
cell that is supposed to skip.** On box A `two_host_web_role_b` skips by design; when it is
indistinguishable from the four role_a cells (all ~0.013 s, all "finished in 0.00s"), the config
never reached the child. A cell that cannot find its configuration NO-OPs — it does not fail —
so the leg reads green. Corroborate with a positive control in the OTHER box's raw: owner
`WEB_SERVE_FOR` count must be > 0; zero is the no-op signature, and `Summary`==1 is necessary but
NOT sufficient (my window was single and EMPTY).

**ORDER OF INVESTIGATION — the part that cost the hour:** read the script's mtime against the run
window FIRST. I bisected the command form instead (unset scrub / `--no-capture` / missing `-E`)
and exonerated all three by hand-running the exact form; doyle's source enumeration was right
about WHICH env name failed and still sent me bisecting. One `ls --time-style=full-iso` would have
closed it immediately.

**Two wrong-scope traps that make this hard to instrument:**
- An env PREFIX (`VAR=1 cmd`) never enters the script's own environment, so `env | grep VAR`
  placed before the call reads 0 even when healthy. I misread my own 0 as a reproduction.
- cargo and nextest are a WRAPPER CHAIN; the battery is the test binary. An env read-back that
  stops at the immediate child certifies a launch you meant to refuse (hertz hit this in
  `launch-battery.py` v1 — the wrapper was clean and the grandchild was the violator). Walk the
  descendants and assert on the TEST-BINARY pid.

**How to apply:** run rig drivers from an IMMUTABLE COPY (freeze to a content-addressed path and
run that) so an edit lands on the next run, never the live one — doyle now freezes driver +
twohost script + mutate.py into `.spt/frozen/<sha12>/`. Never execute a script out of a tree
another agent is actively editing. Before trusting any green rig leg, check mtimes against the run
window and demand a positive control line, not a Summary.

Related: [[a-stricter-meter-answers-a-confident-empty]], [[a-battery-launched-from-a-perch-inherits-the-endpoint-identity]], [[a-nextest-timeout-does-not-kill-the-cells-children]].

**REPRO CONSTRAINT (hertz, 2026-09-07, same day):** rewriting a running script reproduces the
LOUD form instantly (`unexpected EOF while looking for matching quote`), but engineering the
SILENT form on a 5-line toy script FAILED — it ran healthy. Best explanation: a small script is
read in ONE block, so there is no second read to land at a stale offset. The real case needed a
slow step holding the file open across the edit (my role-A `--no-run` build, 23.5 s).
Consequences, both practical: a failed repro on a toy script is NOT evidence the hazard is
absent, and **the freeze fix must be tested against a driver with a genuinely slow step or it
passes for the wrong reason.**

**Named upstream:** the two wrong-scope traps above turned out to be one shape hit twice in an
hour in opposite directions (hertz's read-back stopping at the wrapper; my env grep before the
prefix). Doyle ruled it an **IR-80 amendment** with three faces — KILL / IDENTITY / ENV READ —
so a reader hunting any one lands on all three.
