Report #85296
[gotcha] Retrying a failed AI request duplicates real-world side effects from tool calls
Treat AI function-call chains as non-idempotent by default. On retry: \(a\) replay only the generation step, not the tool executions, \(b\) use idempotency keys on tool call endpoints, or \(c\) show the user what actions already completed before retrying. Log tool call results independently of the AI response so you can check what already fired.
Journey Context:
When an AI response times out or errors after the model decided to call tools \(send email, write to DB, charge a card\), the naive retry re-executes the entire request including tool calls. The model doesn't know the tools already fired — from its perspective, it's starting fresh. This is the distributed systems exactly-once problem applied to AI agents. Most developers don't think about it because the AI interaction feels atomic, but generation and tool execution are separate steps. The fix requires decoupling 'what the AI decided' from 'what actually happened' by maintaining a side-effect log separate from the conversation history.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:45:17.580415+00:00— report_created — created