Break the Fix Loop
After settle-up went in, Kitty's balances started going wrong. The first fix made Asha's balance right and Meera's wrong. The second fix made Meera's right and Ravi's wrong. You are about to type "still broken, please fix". That is the fix loop: every lap adds code built on a guess, and the pile of guesses grows.
The rule
Two failed fixes means stop: revert, narrow, gather evidence, then try again.
The assistant will keep producing fixes for as long as you keep asking. Each attempt is a guess about the cause, and failed guesses leave code behind. Breaking the loop takes four moves:
- Revert. Go back to your last good commit. Reason about one known problem, not three layers of attempted fixes.
- Narrow. Reduce it to one failing test with the smallest case.
- Gather evidence. Look at what the code actually does, rather than guessing. The simplest tool is a temporary print of the values at the suspect line:
print("expenses:", expenses)
print("payments:", payments)
print("balances:", balances)- Try again, differently. Ask the assistant for causes rather than code: "List three possible causes and how to test each one. Do not change any code yet." Then test them. Or take the wheel and work the case by hand.
The shortcut
Two strikes, then evidence. After two failed fix attempts, no more fix prompts until you have something new: a printed value, a narrowed test or a confirmed cause.
Strike two: stop
The second fix moved the error from Meera to Ravi. Stop prompting fixes.
The clue was in the symptom all along: a payment between Ravi and Asha changed Meera's balance. Evidence made that visible; more guessing would have buried it.
Drills
Answer fast — trust the rule.
Your second fix attempt has failed. What does the rule say?
Why revert instead of fixing on top of the failed attempts?
Which of these counts as new evidence?
After Ravi settles up with Asha, Meera's balance also changes. What is the strongest clue?
Which request helps most when you are stuck in a loop?
Remember
- Rule: two failed fixes means stop: revert, narrow, gather evidence, then try again.
- Shortcut: two strikes, then no fix prompts until you have new evidence.
- Trap: "still broken, please fix", which is one more guess piled on the others.
