Test-and-fix loop

After every change, run the tests and read the failures.

What it is
The agent runs the relevant tests (or writes a failing one first), reads the failures, fixes, and repeats until they pass or a budget runs out.
When to use it
  • Any repo with tests, or where a reproducing test can be written
When to skip it
  • Letting the agent edit tests to make them pass: guard the test files
Why (the trade-off)
It's the coding version of a verifier: the agent stops guessing whether its code works and checks.
Where it sits
Control layer, inside the agent loop, executed in the sandbox.
What it needs first
What can be added to it
  • pairs withCI gatethe full suite still runs before merge
Effect of adding it
  • cost ↑
  • latency ↑
  • reliability ↑↑
  • safety —
Risks it handles
  • Fixes the wrong thing · partial
  • Breaks something else · partial
Learn first (AI Engineering)