- A timeout leaves a remote action unresolved until its outcome is checked.
- Persist one action identity before dispatch and reuse it across permitted retries.
- Separate duplicate prevention from reconciliation and customer confirmation.
At 2:14 a.m., the refund call times out.
A second request receives a fresh identity.
Two successful refunds can follow one support task.
Hypothetical scenario. Act 3, the bad week. Northwind’s refund agent sends a payment request, receives no reply and tries again with a new key. The customer sees two refunds. Priya needs to explain the outcome while Dev determines which action records correspond to the customer’s one intended refund.
A timeout describes the observer’s deadline
A timeout means the caller stopped waiting before receiving a usable response. The provider might not have started, might still be executing or might have committed before its response was lost. The caller’s local exception does not distinguish those states. A new attempt must preserve that uncertainty rather than silently translating it into confirmed failure.
Idempotency means repeating an operation has the same intended effect as performing it once. RFC 9110’s HTTP semantics defines idempotent methods, including the safe methods and PUT and DELETE. POST is not idempotent by default. A payment API can add an application-level key contract that recognizes repeated POST attempts as the same logical operation.
Reconciliation determines what happened to an unresolved action by consulting authoritative evidence. It is different from retry scheduling. A status lookup can discover that a timed-out refund succeeded; a retry can return a previously saved result. Northwind needs a durable identity tying either answer to the original intended action before it tells the customer the outcome.
Create the action before the first network attempt
Persist an action identity, order reference, amount, currency and request fingerprint before contacting the payment provider. The fingerprint binds the identity to the intended effect. Reusing one key for a different amount should be rejected, not interpreted as a convenient update to the previous operation. Keep sensitive customer information out of the key itself.
A model-generated tool-call identifier is not automatically the business action identity. Regenerating the model response after a worker crash can produce another proposal for the same customer request. Northwind’s workflow should resolve that proposal to the existing approved action when it represents the same intent. A deliberately requested second refund requires a new authorization and action identity.
The durable record also gives concurrent workers a common object to claim. A unique constraint can prevent two workers from creating the same action record locally. It does not by itself prevent duplicate effects at the remote provider. The provider-facing key and reconciliation path must preserve the identity across the boundary where the effect actually occurs.
Read the provider’s exact contract
Stripe’s idempotent-request documentation states that API v1 saves the first status and body after execution begins, including a 500 response, and replays it for the same key. It also compares parameters and permits pruning keys once they are at least 24 hours old. A pruned key can therefore begin a new request; retention is part of the safety boundary.
The same documentation distinguishes API v2 behavior, where retries can continue failed or partially failed work and return an updated response. Northwind must bind recovery to the actual endpoint contract rather than apply the v1 response-cache rule to every Stripe operation. A familiar header name does not imply identical semantics across API versions or providers.
An HTTP failure response is not always proof that no effect occurred. Inspect the provider’s operation state and documented recovery rules. For a saved error result, repeatedly replaying the same response is not progress by itself. Escalate unresolved business state to reconciliation rather than generating a new key simply to obtain a different HTTP response.
Derive the duplicate exposure without calling it an incident rate
Hypothetical worked example: Northwind requests 1,000 refunds per day and assumes 0.2% end in ambiguous timeouts. The number of ambiguous calls is 1,000 × 0.002 = 2 per day. Assume half of those had already committed remotely when the response was lost. That leaves 2 × 0.5 = 1 committed-but-unobserved action per day on average under the chosen assumptions.
If every ambiguous action is retried as a new independently executable refund, that one committed action is exposed to a duplicate. This is approximately 1 potential duplicate per day, not a measurement and not a claim that every timeout duplicates money. The estimate depends on the assumed timeout rate, committed fraction and behavior of the newly identified attempt.
Now hold the original action identity across retries under a valid provider key window. Repeated delivery can refer to the same operation rather than create another refund. That changes the effect semantics, but the application still needs to learn the outcome and handle cases outside the provider’s retention or recovery guarantees. Duplicate prevention and customer confirmation remain separate requirements.
A recovery record needs three distinct outcomes
Use confirmed when provider evidence establishes the refund succeeded. Use confirmed-failed when authoritative evidence establishes that the intended effect did not complete and the applicable contract allows the next recovery step. Use unresolved when the evidence is insufficient. A local timeout belongs in the third category, even when the application displays an error message to its operator.
For an unresolved action, first query status by the stored provider reference or supported idempotency identity. If the provider permits resending the identical request with the same key, do so within the documented rules and remaining budget. If no safe automated path remains, preserve the unresolved record for review. A human needs the original identity and evidence, not a fresh attempt that hides the earlier uncertainty.
Brandur Leach’s Postgres idempotency design describes using durable records and recovery stages around external effects. Its value here is the explicit recovery progression; it is not evidence of Stripe’s private storage layout. Northwind can adopt the principle of recorded progress without claiming that a vendor implements the same schema or transaction boundaries.
Backoff schedules attempts; it does not authorize effects
AWS’s timeouts-and-retries guidance explains that timeouts do not establish that side effects did not occur and that retries add load. Northwind sets the retry decision at the workflow level so nested model, tool and HTTP clients do not each spend an independent attempt allowance. The remaining deadline must cover the attempted work and its observation.
AWS’s backoff-and-jitter analysis shows why spreading retry times helps avoid synchronized contention. Full jitter selects a delay from zero to the capped exponential bound. That is a scheduling mechanism. It does not make a newly keyed refund equivalent to its predecessor or repair a missing business identity.
Reserve time for status lookup or handoff rather than spending the entire interaction deadline on submissions. If the provider remains unavailable, Priya should see a pending refund with a known action reference. The customer should not receive a success statement until confirmation exists, and should not be asked to repeat the request without reference to the unresolved action.
In the wild: a documented replay contract
Stripe’s API v1 documentation provides a concrete public example of recognizing retries by key and checking parameter consistency. AWS describes the load and uncertainty consequences of retrying distributed operations. Together they support a limited conclusion: safe repetition needs both a defined operation identity and a policy for observing outcomes. Neither source promises a universal exactly-once result across arbitrary services.
The case also explains why caller-generated keys require retention planning. If Northwind can retry a support task after the provider has forgotten its key, the application needs another authoritative reference or a manual reconciliation process. Local records should remain available for the full operational recovery interval; copying a provider’s minimum key duration into every local retention rule is not sufficient reasoning.
Where the rule changes and where it does not
A read-only model completion can often be retried without duplicating a payment, though it still consumes budget and can produce a different answer. A tool that sends email, opens a ticket or changes inventory has a separate effect contract. Classify operations by their consequences instead of applying one generic retry wrapper to every tool name.
Common misconceptions are that a timeout means failure, that a correlation ID itself prevents duplicate execution, and that backoff supplies idempotency. A correlation ID connects observations. A deduplication key changes repetition semantics only when a service enforces it. Backoff changes when another attempt occurs. Keeping those roles distinct makes a failed run much easier to recover.
Limits: provider retention, missing status interfaces and genuinely ambiguous external outcomes can prevent automatic resolution. Reconciliation can require a person and can outlast an interactive request. Northwind’s decision is to retain one approved action identity, stop blind newly keyed retries, and report uncertainty honestly until authoritative evidence supports the customer-facing result.
Check yourself: retrying decisions
The payment call times out. Is a new key a harmless retry?
No. The first operation might have committed; a new key can authorize another effect. Preserve the existing action identity and reconcile.
A Stripe API v1 key replays a 500. Does resending necessarily rerun the operation?
No. The documented v1 contract can return the saved status and body. Inspect the provider state and recovery rules instead of assuming fresh execution.
A worker has an exponential backoff policy but no durable action record. Is duplicate prevention established?
No. Backoff schedules attempts. The missing identity and remote enforcement still leave repeated effects possible.
Next read: OpenTelemetry Traces vs. Audit Logs for AI Agents: What Each Can and Can't Prove.