Skip to content
Hammad Yousuf.
Idempotency and retries · NOTE 12

Idempotency: test a successful write with a lost reply

The write succeeded. The reply disappeared. Then the retry created a duplicate.

Synthetic local lab · 4 October 2026
Hammad Yousuf
By Hammad YousufSoftware, AI & automation
WRITE SUCCEEDS → REPLY LOST → RETRY SAME ACTION
Lost-reply simulation · Open access

What to inspect

A timeout leaves the caller uncertain about whether the operation committed. This sequential local simulation drops the first response after writing. Repeating the same intended action creates two records without deduplication and returns one stored result with a supported action key.

Worked example

The teaching script uses action_42 twice. The naive path creates records 1 and 2. The deduplicated path returns record 1 twice. This is an in-memory simulation; production behavior also depends on persistence, atomicity, concurrent requests, key expiry and changed-input handling.

Replay the lost response

Deterministic simulation in your browser. No model, API call or external write.

Copy the full prompt

Adapt the inputs to your task. Remove private data before sending anything to a model. This page copies text locally; it does not run the prompt.

Full prompt · adapt the inputs
Review [WRITE WORKFLOW] for retries after a lost response. Separate operation success from response delivery. Define how the same intended action is identified, where its result is persisted and what happens for changed payloads, concurrent requests and expired keys. Propose a local mock test. Do not claim that adding a header alone provides idempotency unless the receiving service supports and enforces it.

Review checklist

  1. Reuse the same action identity for the same intended write.
  2. Confirm that the receiving service enforces deduplication.
  3. Test success followed by response loss.
  4. Check concurrency, persistence, expiry and changed inputs.

Keep the resource

Download the complete note ↓Markdown · explanation, example, prompt and checklistDownload the prompt ↓Plain text · ready to adaptOpen the full-size visual ↓SVG · scalable reference diagramDownload the runnable example ↓Python + README · local synthetic tests, no API key

Documentation & scope

Stripe: idempotent requests ↗

These constructed examples demonstrate application behavior. They are not model benchmarks or production implementations. Provider APIs can change; check the linked documentation for your exact integration.

Have a workflow to review?

Bring the task, inputs and the result you need. We can discuss the integration and the checks around it.

Discuss your workflow ↗