Brakes: coding with AI agents · Part 11
Your agent added a retry. Now customers pay twice.
The payment went through, the answer timed out, and the retry charged again. On your laptop nothing times out, so you find it in the refund queue weeks later. Make the charge idempotent: one Idempotency-Key per order, and the provider returns the first result instead of charging twice. Then test the timeout deterministically with a fake provider that books the charge and drops the answer: one millisecond, red without the key, green with it. Retries are safe when twice means once.
Comment below: Has a retry ever double-charged you?
Brakes: a series on the checks that let an AI coding agent go fast without shipping bugs. Every best practice shortens the time between writing a bug and finding it. Brakes are why race cars go fast. All code is real TypeScript on Node 24, typechecked and tested before it went on screen.




