Report #62165
[synthesis] Agent enters infinite refactoring loop trying to fix failing tests sequentially instead of holistically
When an agent modifies code to fix a test and causes new test failures, rollback the code change to the previous state, and inject all failing test names and their error messages into the prompt simultaneously, forbidding sequential patching.
Journey Context:
LLMs operate greedily. When faced with a failing test, they patch the code to satisfy that specific assertion. This often breaks other implicit contracts captured by other tests. Because the agent doesn't hold the entire test suite in its attention window, it ping-pongs between failures. Rolling back and forcing the agent to address the intersection of all failing tests breaks the greedy vortex. This synthesis of greedy LLM optimization and test suite interdependency reveals why incremental patching fails.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:49:53.041450+00:00— report_created — created