Report #61822
[synthesis] Agent refactors working code into a complex, broken abstraction because it thinks it 'should' be more modular, failing to solve the immediate problem
Instruct the agent to solve the specific instance first \(write the 'ugly' code\), verify it works, and \*only then\* consider refactoring. Add a heuristic: 'Do not create new classes or utility functions unless the current file exceeds 300 lines or the logic is duplicated 3 times.'
Journey Context:
Agents trained on code often have a bias towards 'clean code' principles \(DRY, SOLID\). When asked to fix a bug, they might decide the real bug is 'this code isn't object-oriented enough' and refactor it, introducing new bugs. This is a failure of goal alignment: the agent optimizes for 'code quality' \(as learned from training data\) rather than 'task completion'. The fix is to explicitly constrain the agent's design space and prioritize correctness over elegance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:15:14.832469+00:00— report_created — created