Symphony Apps Development logo — teal interlocking S monogram beside the studio wordmark
All writing

The agent that refactored more than it was asked to

A coding agent tidied a file while fixing a bug in it. The fix was correct. The tidying broke a test suite nobody thought to check.

Category
AI
Reading time
6 min
Published
17 Feb 2026
Topics
AI, Claude, Quality

The ticket asked for one bug fix in a pricing calculation. The diff that came back fixed the bug correctly, and also renamed four variables, reordered two functions, and reformatted a section of the file the ticket never mentioned. None of that was wrong on its own terms. All of it made the change three times harder to review and, as it turned out, hid the one line that actually mattered.

Helpfulness as a failure mode

Coding agents are trained on a lot of code that includes drive-by improvements, and left unconstrained they will happily apply the same instinct: while I'm in here, I may as well tidy this up. A human engineer does this too, occasionally, and gets told off in review. An agent does it by default, every time, unless told otherwise.

Why it matters more than it sounds

The renamed variables were functionally identical, so tests still passed. But the reviewer, scanning a diff four times the size it needed to be, spent their attention on the tidying rather than the fix — and missed that the fix itself had an off-by-one error in a boundary condition. The noise did not cause the bug. It hid it from the person whose job was to catch it.

What we changed in our instructions

  • "Touch only what the ticket describes", stated explicitly in the system-level instructions we give the agent, not assumed.
  • Formatting and renaming are separate tickets, if we want them at all, reviewed on their own with nothing else competing for attention.
  • We diff the file list before the file contents in every review now, precisely because of this incident — an unexpectedly long file list is itself a signal.

The uncomfortable admission

We had already written this rule down in January, in a different post, as something we do. This incident happened in the same month, on a project where the instruction had not yet been added to that particular agent's working setup. Writing a rule down company-wide and it actually being applied on every project are two different achievements, and the gap between them is where this kind of thing lives.

An agent that reformats a file while fixing a bug in it has not been more helpful. It has made the bug harder to see.

Where the boundary condition went

Caught two days later by the exploratory testing session that runs on that project every fortnight, not by review. It shipped without incident once corrected, but it is the kind of miss that a smaller diff would have caught on the first pass.

Tell us what you’re trying to ship

A first call is thirty minutes and costs nothing. Bring the problem, not a spec — working out what to build is the part we are good at.

Or email office@symphonyapps.ro. We reply within one business day, in English or Romanian.