Report #69094
[synthesis] Agent recursive self-repair loops cause context window explosion and silent truncation
Cap the retry depth for self-repair to a maximum of 2 iterations, and on the 3rd failure, switch to a reset strategy that re-initiates the task with only the original goal and the final error message, discarding the failed context.
Journey Context:
A common pattern is to feed the error traceback back to the agent so it can fix its own code. However, if the fix introduces a new error, the context grows rapidly \(original code \+ error 1 \+ fix 1 \+ error 2 \+ fix 2\). Eventually, the context window silently truncates the original system prompt, causing the agent to forget its formatting constraints or ultimate goal. The agent doesn't crash; it just outputs garbage. The synthesis is that self-repair is a linear operation that creates quadratic context growth. You must actively prune or reset the context to break the cycle.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T22:27:27.555482+00:00— report_created — created