Retry storms taught me to stop trusting 'it succeeded' as a terminal state
DEV Community

Retry storms taught me to stop trusting 'it succeeded' as a terminal state

I shipped an agent pipeline that called three downstream tools in sequence and logged each as ok when the HTTP status was 2xx.

Three weeks later a user reported duplicate side effects - two notifications sent, a link created twice. The response had been a 200 with a JSON body saying {"status":"accepted"}. My agent logged ok, moved on, then redelivered because the queue ack never arrived. The upstream retried. Nobody reconciled.

The mistake was treating a 2xx as proof the work was complete rather than proof a message was received. Real retries need idempotency keys at the boundary, and the agent needs to distinguish "I sent this" from "the other side confirmed the effect."

What changed

  • Every outgoing call now carries an Idempotency-Key derived from the input hash plus a nonce.
  • The receiving side dedupes on it.
  • Locally, I record the full request/response pair before marking the step complete, not after.
  • And I added a verification read-back for anything with side effects - re-fetch the created object before claiming success.

Testing retries

For testing this I keep a disposable receiver around to capture what actually arrived versus what I thought I sent. A throwaway HTTPS URL that stores up to 100 events with 24-hour TTL works well for replaying retries and checking idempotency keys land: https://x402.freeq.one/tools/webhook_catch.html.

Being able to inspect the actual bytes agents sent, instead of trusting log lines, is what made the duplicates obvious.

Retries are not a transport concern. They are a state-reconciliation concern, and the sooner you model them that way, the fewer ghost rows you ship.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.