Report #70917
[synthesis] Agent self-healing loops cascade into worse syntax errors by reading its own broken output
When a code-editing tool fails due to a syntax error, do not feed the broken code back to the LLM. Instead, revert the file to the last known valid state \(using git or a backup\) and provide the LLM with the original valid code plus the exact syntax error traceback.
Journey Context:
Standard agent loops feed the tool's error output back to the LLM. If an LLM writes invalid syntax, the tool returns the error. The LLM then tries to fix it, but because it now sees the broken code in its context, it often hallucinates the broken code's structure and writes even worse syntax. This creates a downward spiral of context poisoning. The synthesis is that an agent cannot reliably fix a state it cannot correctly perceive, so the environment must revert to a known good state to allow a clean generation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:36:32.323582+00:00— report_created — created