Bound the process output a model receives: exec_poll returns the whole capture buffer every time #394
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/wi-01a0c901-bound-the-process-output-a-model-receive"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
MAX_OUTPUT(1 MiB per stream) bounds what the executor captures. It was also, in effect, what it returned: bothexec_pollpaths embedded the whole captured buffer for stdout and stderr, so one receipt could carry 2 MiB of text into a model conversation.Polling compounds it: a poll of a still-running process returns the live snapshot from byte zero every time, so polling a chatty command N times re-sends the entire accumulated buffer N times.
Evidence
Reviewer session
01a0c8bc-b7c3-7d93-9963-3e8a1d5f379f(sekhmet, 2026-09-22, 44 min), read read-only from the session-relay API:run_command/poll_commandpairs, every call succeeded — no failure, no missing capabilitysubmit_review_verdictwas advertised to the session and never reachedreview_rounds: 0One of 7/23 reviewer sessions that day that bound a runtime, burned a full ~30-minute slot, and produced nothing.
Fix
Capture is unchanged — the receipt still records true byte counts and the existing truncation flag. Only the model-facing text is bounded: 24 KiB per stream (16 KiB head + 8 KiB tail) with an explicit marker naming bytes dropped and bytes captured. Head and tail are kept because a reviewer needs how a build started and the error that ended it. The split lands on a UTF-8 boundary — a naive cut emits replacement characters mid-codepoint.
Adds
stdout_bytes,stderr_bytes,elidedso a caller can distinguish an elision from a command that genuinely printed little; previously indistinguishable.Deliberately not done
Making
exec_pollincremental is the deeper fix but would silently change what existing callers receive. Out of scope here.Verification
6 new tests: at-budget verbatim passthrough; the observed 227 KB stream bounded with its true size still reported; head and tail both surviving; UTF-8 boundary safety; empty output; and the model budget staying well under the capture ceiling. Full crate suite 69 passed. Clippy on
executor.rsis unchanged from main (5 pre-existing lines before and after, verified by stashing); theacp.rswarnings are pre-existing and untouched.Gates not pre-cleared; fresh exact-head review and CI required.
🤖 Generated with Claude Code
Full-lane babysit 2026-10-01 — WI-472.
Exact head
1eb1c8cbb2ff5704969201f89a2d068f05db3553, current mainad441fe9e2359a1bf315eda28a4b072cc56cee2d. Real merge-tree clean; branch is not already on main.Bounded head/tail model output and terminal-progress deduplication are implemented with UTF-8/count tests. Merge-tree clean. Hosted test-akh-medu is red; current tracker has no CI/review exit bars. Needs canonical exact-head validation and review.
Individual disposition also recorded in the Anima WI thread. No approval or CI gate was overridden.