Report #7703
[agent\_craft] Failed tool executions and long stack traces pollute the context window causing agent loops
Aggressively truncate failed execution outputs. Keep only the error type, the failing line in the user's code, and the exit code, rather than the full stack trace.
Journey Context:
Agents often get stuck in error loops. Each failed attempt adds to the context. A 50-line stack trace is usually 45 lines of library internals irrelevant to the fix. By truncating to the custom code frame, the agent keeps its reasoning space clear and focuses on the actual bug, breaking the loop.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T03:35:25.166003+00:00— report_created — created