← seriesmaclulich.com

Tag each agent fix with its failing test to spot patching loops across files

Four changes for spotting an agent patching one failure across files

  1. Count each fix once, not once per file it touchedMy disk cleanup was 21 fix commits across six files in 60 days, or 29 fix-to-file touches.
  2. Tag every fix commit with the failing test it fixesNaming the test groups fixes for the same failure across files.
  3. On a retry, have the agent link the existing failure before it edits againIf a reminder counts by file, a repeat can look like several unrelated fixes.
  4. Replay a labelled patch history before you trust the reminderMy original cleanup history never had a failure move into a new file, so it couldn’t test that.
The counts come from one of my own disk cleanups, and the other rows are my original trial plan.

Count each fix once, not once per file

If your coding agents keep returning to the same failure, this chapter of Fewer tokens to ship is for you.

Chapter 2 asked whether a warning changes the code. This one looks at repeat work that shows up across several commits.

The corrected cleanup count is 21 distinct fixes, or 29 fix-to-file touches.
The corrected cleanup count is 21 distinct fixes, or 29 fix-to-file touches.

One disk cleanup took my agents 21 fix commits across six files in 60 days, 29 if you count each fix once for every file it touched.

That history got me counting fixes by file. It also raised a question for bugs that move across files. Original account

The earlier account called those 29 fix commits, and its 47 total commits did not reproduce. I now count each fix once and say which unit I counted.

Tag every fix with its failing test

A reminder in my setup asks the agent to redesign when fixes pile up in one file.

But the same failing test can send an agent into a different file on each attempt, and if the reminder counts by file, the repeat can look like several unrelated fixes.

A Fixes-Test trailer puts two fixes in one history by naming the same test in both commits.
A Fixes-Test trailer puts two fixes in one history by naming the same test in both commits.

A reader suggested naming the failing test in the fix commit. That would group fixes for the same test across files. If there’s no test to name, I can still count by file. Reader discussion

How far to trust it

The cleanup history never tested a failure that moves files

  1. Not exercisedThe original cleanup history did not exercise a failure moving into a new file.
  2. No test, no groupingIf there’s no test to name, I can still count by file.
The trial results are in chapter 5.

Try it on your rig

  1. Use the test ID from the work record, or give a reproducible failure a stable ID and save its command and expected result.
  2. On a retry, ask the agent to link the existing failure before making another edit.
  3. When a failure has no ID, a matching filename can help you investigate.
  4. Replay one labelled patch history and a case where the same failure moves files.
  5. Check whether the reminder finds the repeat, misses it or interrupts unrelated work.

To follow along on your own setup, start with the shared work record in the series setup guide.

Seeing the loop is only the start. Next, what does the agent need to break it?