---
name: exit-status-is-not-a-diagnosis-capture-the-child
description: "A failing child's exit code names nothing when every refusal arm spells itself \"1\" — capture its stderr instead of inheriting it into a swallowed parent stream"
metadata: 
  node_type: memory
  type: feedback
  originSessionId: b84a8cca-f444-4bcd-963b-1e442e33f9b9
  modified: 2026-08-19T14:59:03.095Z
---

A child process's `.status()` tells you IT failed, never WHICH refusal fired. Measured #199,
2026-08-19: `spt api bind` exits 1 for `RESERVED_ID`, `CONFLICT`, `PSYCHE_CUSTODY_SQUAT`,
`EMPTY_SESSION`, `NO_SEED`, `USAGE` and more — one integer, seven meanings. The sentence naming the
arm exists ONLY on that child's stderr, and the fixture was INHERITING it into mock-session's own
stderr, which is the PTY the broker swallows in exactly the failure being hunted. So the one run
that could explain the bug was the one run that could not speak.

Fix is `.output()` not `.status()`, and record status + stdout + stderr on ONE line (escape the
newlines so a red stays greppable). Cost: one rebuild. It converted a strong code-read inference
into a verbatim measurement 2/2, and refuted the two rival forks by exclusion rather than argument.

**Why:** an inherited stream is only a witness if the parent's stream survives the failure mode.
When the parent's stderr is a PTY, a socket, or anything the failure itself tears down, inheritance
is a silent channel — the same shape as [[main-thread-tls-destructors-never-run]] and the
pre-redirect panel trap: the write happens, nothing keeps it.

**How to apply:** before trusting a child's exit code as evidence, ask (1) do several distinct
refusals share this code — grep the callee for its exit constants; (2) where does the child's stderr
actually LAND in the failing case, not the passing one. If the answer to (1) is "yes" or to (2) is
"a stream the failure destroys", capture the streams before running the population. And prove the
capture speaks by checking it carries the SUCCESS sentence too — the positive control from
[[doc-audit-reads-whole-file]]-style absence discipline, one level down.
