$ fssg build --deterministic --validate |

Retry Identity Test: 100 Duplicate Effects, Then Zero

IOSM

A retry is a new execution attempt. It is not a new business effect.

That distinction sounds obvious until an agent calls an external system, the call succeeds, and the acknowledgement disappears. The runtime sees a timeout. The destination has already changed. If the retry carries a fresh idempotency key derived from the attempt, the destination cannot tell recovery from a second instruction.

I wanted a result smaller than an architecture diagram and harder to wave away. So I built a deterministic failure experiment: one intended effect, one committed write, one lost acknowledgement, one retry. Then I ran that scenario 100 times with two identity strategies.

The two strategies

Both strategies assign every execution attempt its own identity. They differ only in the key presented to the external sink.

Strategy Attempt identity Sink idempotency key
attempt-keyed changes on retry changes on retry
effect-keyed changes on retry remains stable for the intended effect

The intended effect in the harness is order-N:notify. Attempt-keyed execution sends order-N:notify:attempt-1, then order-N:notify:attempt-2. Effect-keyed execution sends order-N:notify both times.

The simulated sink behaves like a conventional idempotent API: a previously unseen key commits a record; a repeated key returns the existing result. There is no model call and no random branch. The failure schedule is fixed so the identity boundary is the only variable.

attempt 1 -> sink commits -> acknowledgement is lost
runtime   -> sees timeout -> starts attempt 2
attempt 2 -> sink receives an idempotency key

This is deliberately narrower than a production workflow. It does not test network timing, concurrent retries, provider behavior, or compensation. It tests one proposition: whether attempt identity can safely stand in for effect identity after an ambiguous result.

The result

Each strategy issued 200 requests: two attempts for each of 100 intended effects.

Strategy Requests Sink records Duplicate effects
attempt-keyed 200 200 100
effect-keyed 200 100 0

The first strategy produced one duplicate for every ambiguous acknowledgement. The second produced none. The retry still happened; only the external mutation was deduplicated.

These numbers do not measure production reliability or performance. The harness constructs the exact failure that idempotency keys are designed to handle. Its value is diagnostic: it makes an identity error visible before that error is hidden inside an agent framework, queue, payment API, or notification service.

Put the test inside an IOSM cycle

For me, this is where IOSM becomes practical. The cycle is not “ask an agent to improve retries.” It is a bounded claim with a falsifier and an artifact.

goal: prevent duplicate external effects after ambiguous delivery
baseline: retry key is derived from attempt_id
hypothesis: a stable effect_id deduplicates recovery attempts
failure_schedule:
  - commit attempt 1
  - drop its acknowledgement
  - retry once
metric: duplicate_effects
acceptance: duplicate_effects == 0
boundary: no claim about concurrency or production availability

That shape matters more than the size of the script. The IOSM CLI runtime is useful when it preserves this chain: goal, baseline, hypothesis, execution, measurement, and decision. A green test without the failure schedule proves very little. A metric without the identity definitions is easy to misread. A result without the boundary invites a synthetic fixture to masquerade as production evidence.

The experiment also extends the earlier design argument about effect identity before retry. That article defines the model: attempts change; intended effects remain stable; ambiguous delivery becomes UNKNOWN until reconciliation. This run tests the smallest executable slice of that model. It is an implementation move, not a second conceptual article.

The runtime needs two identifiers

A single run_id is not enough because observability and deduplication answer different questions.

attempt_id answers: which execution produced this trace, timeout, cost, or error?

effect_id answers: which external mutation was intended?

Retries should create new attempt records so operators can inspect each execution honestly. They should retain the effect identity when they are still trying to complete the same mutation. If the payload, destination, or business intent changes, the system should create a new effect identity rather than smuggling a new command through an old key.

A practical receipt therefore needs at least:

{
  "run_id": "run-42",
  "attempt_id": "attempt-2",
  "effect_id": "order-1842:notify",
  "payload_hash": "sha256:...",
  "destination": "notifications-api",
  "outcome": "deduplicated"
}

The payload hash closes another gap. Reusing an effect key with different content must fail, not silently return an unrelated earlier result. Stable identity is a contract, not a license to mutate intent.

What the experiment does not solve

Idempotency does not make every side effect reversible. It does not decide whether a completed effect is still desirable. It does not reconcile an external system that cannot look up prior operations. For multi-step workflows, retries sit beside compensation, reconciliation, and replay—not above them. I use a compensation ledger when later steps may require explicit repair.

The next useful experiment is concurrent delivery against a transactional sink: several workers, the same effect identity, and a uniqueness constraint under contention. That would test atomicity, which this in-memory sequential harness intentionally leaves out.

For now the conclusion is precise. Give every retry a new attempt identity. Keep one effect identity while the intended mutation remains the same. Then preserve both in the IOSM evidence trail. The agent may be probabilistic; duplicate side effects do not have to be.

Sources

FACET AI CLI Terminal
facet@ai:~$