Report #42391
[agent\_craft] Agent executes a command that returns massive output and it floods the context window
Wrap all shell executions in a truncation layer. If stdout/stderr exceeds a threshold \(e.g., 2000 tokens\), truncate the middle and append a marker, ensuring the first few and last few lines are always visible.
Journey Context:
Raw tool outputs often contain verbose logging that is irrelevant to the actual error or result. An agent seeing 500 lines of npm install progress bars will lose the crucial error message at the end. Truncating the middle preserves the initial context \(what command was run/started\) and the final context \(the result or error\), which are usually the only parts needed for debugging.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:37:29.217305+00:00— report_created — created