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.
Retrying operations that aren't idempotent card 3 of 6

Is this retry safe? Three checks

**Tell:** a retry (a loop, `@retry`, a `retries:` option, a retrying client) around a call that changes another system: a payment, a POST, an email or SMS send, a queue publish, or an insert without a unique key. 1. Does doing it twice change the outcome? Set-to-value and delete-by-id: usually no. Create, charge, send, add: yes. 2. Is the failure ambiguous (timeout, connection reset, 5xx)? Then assume it may have succeeded. 3. If the answer to both is yes, require an idempotency key or dedup.
Terms on this card
idempotency key
A unique id sent with a request. The server remembers it and returns the stored result for a repeat, instead of acting again.
dedup
Short for deduplication: detecting a repeated request or message by a stable id and ignoring the extra copy.
POST
HTTP method that usually creates something or triggers an action. Repeating it usually repeats the effect.
5xx
HTTP status codes 500-599, meaning a server-side error. The request may or may not have taken effect.
connection reset
The network connection was cut off mid-request. The other side may or may not have processed the request.
Learn this step by step on Bytewise
Lesson goal: Spot retry loops the agent wrapped around payments, POSTs, emails or queue publishes. Explain how they cause duplicates when the first attempt actually succeeded but its response was lost, and how an idempotency key or deduplication makes the retry safe. · the whole lesson