Report #45854
[synthesis] Agent context window gets exhausted by recursive error stack traces from failing tool calls
Truncate or summarize stack traces in tool error responses to a maximum token limit, preserving only the top-level error message and the specific line numbers relevant to the agent's code.
Journey Context:
When an agent writes buggy code and runs it, the resulting stack trace can be thousands of tokens long. If the agent fails to fix it, the next run produces another massive stack trace. Within 2-3 iterations, the context is full of repetitive stack traces, leaving no room for reasoning. People try to increase context size, but the traces grow faster. The synthesis is that the agent only needs the delta between the previous error and the current one, plus the root cause. Stripping the trace to just the exception type and the agent's own code lines prevents context exhaustion while preserving debuggability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:26:33.062068+00:00— report_created — created