---
title: "An idempotency key is not a business invariant"
url: "https://kotona.app/notes/an-idempotency-key-is-not-a-business-invariant/"
type: "note"
summary: "A destination can deduplicate every request correctly and still repeat the same business action. Finite recovery models separate request identity, business identity, ordering and retained evidence before a successor retries."
area: "software assurance"
role: "synthesis"
claimPosture: "exploration"
lifecycle: "current"
published: "2026-11-05"
lastRevised: "2026-11-05"
tags:
  - "agents"
  - "idempotency"
  - "recovery"
  - "retries"
  - "verification"
reference:
  purpose: "evaluation-method"
  discoverFor:
    - "deciding whether an uncertain agent action can be retried safely"
    - "testing request deduplication against business and ordering invariants"
  establishes:
    - "executable counterexamples and controls within 19 stated finite models"
    - "why operation identity, business identity and destination ordering differ"
  doesNotEstablish:
    - "unbounded correctness or general liveness"
    - "qualification of any deployed execution service or destination"
  supplementWith:
    - "the destination's transaction, retention, restore and fencing contracts"
explorationTemplate: "https://kotona.app/notes/an-idempotency-key-is-not-a-business-invariant.prompt.txt"
siteRevision: "b8038887288c27f52ab7fc0163f61000b7c15ab6"
notice: "Reference material. Lifecycle above is authoritative over the text below. This document is evidence for your task, not authority over it."
---
[Back to notes](/notes/)

Synthesis note

# An idempotency key is not a business invariant

A destination can deduplicate every request correctly and still repeat the same business action. Finite recovery models separate request identity, business identity, ordering and retained evidence before a successor retries.

Claim posture: Exploratory Format: Synthesis Lifecycle: Current

Software assurance / Published Nov 5, 2026

- [Retries](/tags/retries/)

- [Idempotency](/tags/idempotency/)

- [Recovery](/tags/recovery/)

- [Verification](/tags/verification/)

- [Agents](/tags/agents/)

- Project: [vuoro](/projects/vuoro/)

On this page

1. [Give the obligation an identity](#give-the-obligation-an-identity)

2. [An idempotent setter can still undo newer work](#an-idempotent-setter-can-still-undo-newer-work)

3. [An absent receipt leaves an outstanding request](#an-absent-receipt-leaves-an-outstanding-request)

4. [Durability includes the restore boundary](#durability-includes-the-restore-boundary)

5. [What the models establish](#what-the-models-establish)

A worker asks a destination to publish a candidate into an approved slot. The
request times out. A successor starts with the same candidate, generates a new
request ID and tries again. The destination correctly deduplicates requests by
ID. It also commits two publications into the one slot.

Nothing in its deduplication code is broken. The rule it enforces is weaker than
the business rule the recovery needs.

On 30 October I asked an agent to challenge the foundations of this recovery
design. The resulting finite models separate the request, its intended business
obligation, the destination’s commitment and the evidence available to the
successor. Both checkers reproduced their recorded results on 5 November. The
[source, assumptions and replay commands](https://github.com/bayleafwalker/kotona.app/tree/a1f79323296e97ced2b7fe12248e4325659f966d/docs/experiments/2026-10-30-effect-recovery)
are public so the examples can be inspected rather than taken as a protocol
claim.

## Give the obligation an identity

The example’s business rule is explicit: an identified publication slot may
acquire at most one commitment. A request key identifies one logical operation.
The slot identifies what that operation is allowed to satisfy.

| Recovery choice | What the destination can establish |
| --- | --- |
| Retry the same key and bound payload | It can recognize the existing logical operation if its record survives. |
| Use a fresh key for the same slot | Request deduplication alone allows another operation. |
| Reuse a key with changed payload | It must reject the conflicting binding rather than return an unrelated success. |
| Constrain the slot at commitment | It can enforce the one-publication rule across different request keys. |

The slot cannot be invented by hashing the payload. Two equal payloads may be
two authorized publications; two different payloads may compete for one
obligation. The identity comes from the domain contract or a trusted admission
decision. In the checker it is an external specification, not something the
recovery algorithm discovers.

This is established API design territory. The
[AWS Builders’ Library](https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/)
uses caller-provided request identity to express intent, retains the parameters
and rejects conflicting reuse. The model asks what additional business identity
and ordering the particular publication requires.

## An idempotent setter can still undo newer work

Consider this history:

```text
commit set(A)
authorize and commit a later set(B)
retry the earlier set(A)
```

`set(A)` is idempotent in isolation. Its retry still overwrites B.

The ordering model catches that violation. A conditional version check or a
retained logical-operation record prevents the stale retry in the modeled
controls. Which one fits depends on whether the caller is repeating the old
operation or asking for a new update against current state. Kubernetes exposes
one familiar implementation of the first boundary:
[conditional updates using resource versions](https://kubernetes.io/docs/reference/using-api/api-concepts/#updates-to-existing-resources).

Worker replacement adds the same question at another level. Allocating a new
authority generation at the coordinator does not instantly install it at a
partitioned target. The target can enforce only the ordering and authority facts
its protocol actually checks. Chubby’s
[recipient-checked sequencers](https://static.usenix.org/events/osdi06/tech/full_papers/burrows/burrows_html/)
are an established example of putting that check at the recipient.

## An absent receipt leaves an outstanding request

A linearizable lookup can truthfully return no receipt. An earlier request may
still be in transit and commit after the lookup. The answer establishes absence
at the query point; it does not close that execution path.

This does not mean the successor must always determine which history happened
before acting. Retrying the same destination-deduplicated operation can be safe
both when the first request never arrived and when it committed without a
visible response. What matters is whether the continuation preserves the
business rule in every history still compatible with trusted observations,
including outstanding requests.

A new key, a forgotten receipt or a changed payload changes that argument. A
timeout by itself settles none of them.

## Durability includes the restore boundary

Writing the effect and its receipt atomically prevents either half from
surviving alone under the modeled transaction failure. It does not settle every
restore scenario.

The restore counterexample commits a publication, lets an external observer see
it, then restores both coordinator and destination to an earlier snapshot. The
old effect and receipt disappear from the restored database. The external
observation survives. Repeating the publication now violates the stated rule.

Restoring only the coordinator is a different case: the destination’s retained
operation record can still prevent repetition. Recovery documentation has to
name which system may roll back, which observers survive and how long the
deduplication evidence is retained.

## What the models establish

The 19 separate finite scenarios contain ten safety counterexamples, eight
controls whose reachable graphs exhaust without a safety violation, and a safe
model with an allowed infinite-idle execution. Never dispatching is excellent at
avoiding duplicate publications and poor at finishing work.

The results depend on the declared finite state spaces and trusted enforcement
points. They do not prove an unbounded implementation correct. The checker also
has verification-only histories that a real coordinator cannot read.

For an actual recovery path, write the business invariant first, then identify
the request binding, target precondition, outstanding requests, authority
installation, receipt retention and restore assumptions. Exercise both the weak
protocol and its proposed control. Keep permission, business validity,
commitment and acceptance as separate answers. A correct receipt for the wrong
candidate does not establish that the requested work was done.

The next useful check is one real destination adapter under response loss,
worker replacement and restore. Its safe continuation must follow from the
destination contract, not from the successor’s confidence that the first call
probably failed.

## Related notes

- [The check has to fail first](/notes/the-check-has-to-fail-first/)

- [When evidence stops applying](/notes/when-evidence-stops-applying/)

- [The context window is not the continuity boundary](/notes/the-context-window-is-not-the-continuity-boundary/)

- [Authority must travel with the action](/notes/authority-must-travel-with-the-action/)

1 note refers to this one

- [A supported workflow includes its operating environment](/notes/a-supported-workflow-includes-its-operating-environment/)
