← Brakes: coding with AI agents

Brakes: coding with AI agents · Part 4

Green. Red. Green. Same code.

· by Tony Tang

The same code goes red, green, red, green, so the agent hits rerun until it's green. It wasn't flaky: the test read the real clock, and late in the evening the code's UTC date is already tomorrow, so a valid discount is rejected on its last day. Take the clock away from the code, pass the time in, seed the random data. Now red means red, every run, and the agent fixes the time zone instead of retrying. Same code, same answer. Every time.

Comment below: Do you rerun red tests?

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.

More from this series