Report #80314
[synthesis] Agent loops derail silently after reading large or binary files
Implement strict output truncation and summarization in tool execution wrappers before returning to the LLM, capping at ~2000 tokens, and explicitly inject a 'Tool output truncated' message so the agent doesn't hallucinate the rest.
Journey Context:
Agents often fail not because they lack context, but because they have too much of the wrong context. A common mistake is passing raw \`cat\` or \`read\` outputs directly into the message history. While giving the agent 'all the info' seems helpful, LLMs suffer from attention sink and will try to rationalize garbage data \(like binary characters or massive stack traces\) into their reasoning, leading to confidently incorrect code changes. Truncating at the tool level \(before it hits the context\) prevents the poisoning cascade, whereas truncating at the context window level \(like Anthropic's or OpenAI's native truncation\) just drops the \*oldest\* messages \(like the system prompt\), leaving the garbage intact.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T17:24:50.221643+00:00— report_created — created