Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Sleeps, retries and longer timeouts as 'fixes' card 2 of 6

Timing changes the odds, not the order

builds on: Patching the symptom instead of the cause, Race conditions and interleavings
The agent optimises the proxy signal it can see: a green run. A sleep, retry or longer timeout shifts timing so the bad interleaving gets rarer **on this machine, today**. It creates no ordering. Its green runs happened on a quiet machine. A loaded CI runner, a GC pause or production traffic can make the work take longer than its guess. Later cost: the race ships, fails rarely and can't be reproduced. A sleep also slows every single run.
Terms on this card
CI
Continuous integration: a server that builds the code and runs the tests automatically on every push or pull request.
CI runner
The machine (often shared and busy) that executes CI jobs; its speed varies from run to run.
interleaving
One particular order in which the steps of concurrent tasks happen to run; different runs can get different orders.
race
A bug where the result depends on which concurrent task happens to run first.
proxy signal
A visible stand-in for the real goal (tests green, error gone) that can be satisfied without achieving the goal.
Learn this step by step on Bytewise
Lesson goal: Recognise a race 'fixed' with a sleep, a flaky call wrapped in a retry loop, or a raised timeout. Explain why these pass locally and in CI but fail under load or on slower machines, and what a real ordering fix looks like. · the whole lesson