# Retry needs idempotent effects

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

Free workshop: [Build Agent Loops That Never Stop Shipping](/tokenmaxx#interested).

A consumer can run an event again after failure. Processing guarantees inside one store do not cover every external side [effect](/lore/effect-basics).

> In an idempotent system, the outcome of processing a message once is identical to the outcome of processing it multiple times.

Source: [Q10](/lore/durability-bibliography#q10); [B5](/lore/durability-bibliography#b5-building-event-driven-microservices), [B6](/lore/durability-bibliography#b6-fundamentals-of-data-engineering).

## Failure it prevents

A response disappears after a remote write succeeds, and retry repeats the write.

## Our Effect 4.0.0 reading

`Workflow` identity and `Activity.idempotencyKey` name work. Receiver-side keys or transactional dedupe must enforce the repeated effect’s semantics.

Source: `packages/effect/src/workflow/Workflow.ts`, `packages/effect/src/workflow/Activity.ts`, `packages/effect/src/workflow/DurableQueue.ts`.

## How to check

Lose the response after remote success. Retry the same identity and inspect the authoritative result. This check is our proposal. The books do not prescribe it.

Continue with [Checkpoints follow the promised commit](/lore/checkpoints-follow-commits), [Cleanup can be an idempotent postcondition](/lore/cleanup-can-be-an-idempotent-postcondition).

Connect this to [the existing rat-stack guidance](/lore/concurrent-work-needs-an-owner).

Use [the durability skill](/skills/durability) for the full review. Return to [the durability index](/lore/durability).

## Sources

1. [Bellemare, Adam. Building Event-Driven Microservices: Leveraging Organizational Data at Scale. O’Reilly, 2020.](https://www.oreilly.com/library/view/building-event-driven-microservices/9781492057888/)
   O’Reilly. Chapter 3 Communication and Data Contracts; Chapter 6 Deterministic Stream Processing; Chapter 7 Stateful Streaming; Chapter 9 Microservices Using Function-as-a-Service; Chapter 14 Supportive Tooling. Accessed 2026-10-23.

2. [Reis, Joe; Housley, Matt. Fundamentals of Data Engineering. O’Reilly.](https://www.oreilly.com/library/view/fundamentals-of-data/9781098108298)
   O’Reilly. Part II, Chapter 5: Message Queues; DataOps considerations; Incident Response. Accessed 2026-10-23.

3. [Effect contributors. Effect 4.0.0. workflow/Workflow.ts](https://github.com/Effect-TS/effect/blob/67ba4e46a11ccda0b6761578bfd22c04ae00167d/packages/effect/src/workflow/Workflow.ts)
   Effect-TS. Pinned source for our Effect mapping, not a claim from the book. Accessed 2026-10-23.

4. [Effect contributors. Effect 4.0.0. workflow/Activity.ts](https://github.com/Effect-TS/effect/blob/67ba4e46a11ccda0b6761578bfd22c04ae00167d/packages/effect/src/workflow/Activity.ts)
   Effect-TS. Pinned source for our Effect mapping, not a claim from the book. Accessed 2026-10-23.

5. [Effect contributors. Effect 4.0.0. workflow/DurableQueue.ts](https://github.com/Effect-TS/effect/blob/67ba4e46a11ccda0b6761578bfd22c04ae00167d/packages/effect/src/workflow/DurableQueue.ts)
   Effect-TS. Pinned source for our Effect mapping, not a claim from the book. Accessed 2026-10-23.

## Linked from

- add-a-store → Add persistence through a service named for an application job, with validation, vendor Layers, migrations, bounded reads, and shared backend tests. → [Read page](https://ratstack.sh/skills/add-a-store)

- Agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms.txt)

- Change log → What changed in the files served here, newest first. → [Read page](https://ratstack.sh/log)

- Checkpoints follow the promised commit → Persist state and progress together when one store can transact both. → [Read page](https://ratstack.sh/lore/checkpoints-follow-commits)

- Cleanup can be an idempotent postcondition → Already-absent state can be success when absence is the operation’s intended result. → [Read page](https://ratstack.sh/lore/cleanup-can-be-an-idempotent-postcondition)

- Dead letters need a return path → Exhausted work needs durable evidence, an owner, and deliberate redrive. → [Read page](https://ratstack.sh/lore/dead-letters-need-a-return-path)

- durability → Keep a rat-stack app standing when a provider, pool, or dependency slows down or a worker dies. Use at any I/O boundary, connection pool, provider call, shared waiter, fan-out, flag, gate, or work that can outlive a request, or when asked "what happens when this is slow", "add a timeout", "make this durable", or "what survives a crash". → [Read page](https://ratstack.sh/skills/durability)

- Durability starts with a recovery record → A reading order for storage, replay, worker ownership, overload, and recovery tests. → [Read page](https://ratstack.sh/lore/durability)

- Full agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms-full.txt)

- HTTP success needs a status check and a decoder → Supply the client, check the response status, decode accepted data, and name failures at the adapter boundary. → [Read page](https://ratstack.sh/lore/http-responses-need-validation)

- Rat Stack lore | rat-stack → Short, source-grounded notes on the ideas and decisions behind rat-stack. → [Read page](https://ratstack.sh/lore)

- Request lifetime is not durability → Worker waitUntil has a shared post-response allowance; required work needs a durable marker and redrive. → [Read page](https://ratstack.sh/lore/request-lifetime-is-not-durability)

- Source change history (log.md) → The generated change log as Markdown. → [Read page](https://ratstack.sh/log.md)

- Timeouts bound waiting → A local timeout stops waiting; it does not prove the remote action never happened. → [Read page](https://ratstack.sh/lore/timeouts-bound-waiting)
