Recovery after an idempotency ledger rollback: authoritative evidence and replay safety

Hi Temporal community,

I would appreciate a design review of a disaster-recovery scenario involving an external effect and a separately restored idempotency ledger. This is a broader failure model than Workflow Reset alone.

Related discussion:

Consider the following hypothetical sequence:

  1. An Activity sends business operation K to a non-idempotent downstream service.
  2. The service commits an effect that survives the later recovery event, but its response is lost.
  3. A separate application-side deduplication or recovery database is restored to a snapshot taken before K. Its uniqueness constraint is intact, but the record for K is absent.
  4. Temporal retries the Activity, or an operator resets the Workflow. K remains stable across attempts. Temporal persistence itself is not restored in this example.

The restored ledger’s absence of K does not by itself distinguish ‘never committed’ from ‘committed, then evidence rolled back’. A lookup also needs to account for an older request that may still commit after the lookup.

I am trying to identify the strongest conventional recovery design under these explicit assumptions, rather than attribute this failure to Temporal. In particular:

  • Where should authoritative evidence of commitment live, and which recovery guarantees must it have relative to the effect?
  • If the downstream service has no durable idempotency key or reliable operation lookup, is blocking automatic replay pending external reconciliation the appropriate policy?
  • When lookup is available, what contract makes ‘not found’ sufficient to authorize another attempt? How should an in-flight older request be excluded or fenced?
  • Would an independently retained ledger, a transactional outbox/inbox, or a recovery epoch help here, and under which additional assumptions? I would especially welcome explanations of where those mechanisms stop helping when the final effect is outside their transaction.

For a failure-injection test, I would keep the downstream effect history independent of the restored database and use it as the measurement oracle. Proposed measurements are committed effects per K, successful recovery when no effect occurred, time spent blocked, and the evidence used for each replay decision. A deliberately restored application ledger would be a separate test condition from ordinary retry or reset.

This is a proposed test scenario, not a reported result or a claim that FCI provides a new guarantee. Standard mechanisms may already cover it under the right assumptions. Existing examples, corrections to the failure model, and recommended recovery contracts would all be useful.

Thank you,
Alexandre Couret

To make this design question testable, here is a proposed comparison protocol. I would welcome corrections before treating it as a fixed experimental specification. No results are claimed in this post.

Architectures to compare:

A. A Temporal Activity calling a non-idempotent target, with a stable business-operation ID but no target-side enforcement.
B. The same integration with a check-before-call.
C. Atomic target-side deduplication, with the key, result, and effect committed in one transaction where that is possible. Its recovery and retention assumptions would be stated explicitly.
D. A conservative recovery policy, implemented as an FCI candidate and as a conventional baseline: reconcile when authoritative evidence is available, otherwise block replay.

For D, both implementations must receive the same evidence and have access to the same services. Refusing an uncertain replay is not, by itself, an original contribution.

Proposed scenarios:

  1. No initial commitment, no older attempt in flight: recovery should eventually complete when the required services are available.
  2. Commitment followed by a lost response, with authoritative evidence retained: recovery should avoid a second effect and recover the prior result when supported.
  3. Reset while an older Activity is still active: synchronize both requests at the receiver and count actual commitments, separately from HTTP arrivals.
  4. Application ledger rollback while the external effect survives: exercise both a committed history and a never-committed history.
  5. A lookup returns ‘not found’ while an older request can still commit: test the required exclusion, fencing, or target-side atomicity.
  6. Authoritative evidence is temporarily unavailable, then becomes available: measure both safe blocking and subsequent progress.

A key control for scenario 4 is to construct two histories that expose the same evidence to the controller but differ in whether the effect already occurred. If the implementation distinguishes them, the test must identify the additional observable that enabled that distinction. A rollback detector or independent witness must not be silently granted to one architecture only.

An independent measurement oracle would record committed effects per K. Controllers would not read that oracle unless its evidence is explicitly part of their architecture. We would also measure recovered results, decisions and their supporting evidence, latency, storage and lookup costs, and operations still blocked after evidence and services recover.

Safety and progress should be reported separately: an always-blocking controller can avoid duplicates while failing recovery. Likewise, a refusal in a history with no commitment may still be justified if the available evidence cannot distinguish it from a committed history.

Would these controls provide a fair comparison? Which standard Temporal integration or reconciliation pattern should be added as the strongest baseline?

A small local illustration of the indistinguishable-history case is now available: CAUSAL-PAIR-01. This is a synthetic SQLite model, not a Temporal integration test or an execution of the existing FCI engine. It illustrates a standard information limitation; no novelty or FCI advantage is claimed.

Construction:

  • H0: no initial effect is committed.
  • H1: a subprocess commits an effect, commits its receipt in a separate database, then exits with os._exit(73) before returning a response.
  • In both histories, the receipt database is restored from the same empty, schema-valid snapshot. The external effect database remains untouched.

The restored database bytes and the serialized observations available to the controller are identical. No older request remains in flight in this model.

Observed final effect counts per business operation K (H0 / H1):

  • Blind replay: 1 / 2.
  • Check the restored ledger, then replay if absent: 1 / 2.
  • Conventional conservative rule: 0 / 1.
  • Minimal FCI-labelled candidate rule: 0 / 1.
  • Positive control with an explicitly added authoritative witness: 1 / 1; the prior result is also recovered in H1.

The two conservative rules are deliberately the same implementation under different labels. Their equality is not evidence about the capabilities of a production FCI system. The witness control receives additional information and is not a same-evidence comparison. Its exact lookup contract assumes a quiescent receiver.

There are ten cases per Python mode, twenty executions in total. Normal and optimized Python produce identical per-case results. A separate read-only verifier opens all sixty SQLite files and checks integrity, final effect rows, snapshot hashes, and agreement with the JSON reports. This is an internal second-reader audit, not independent external validation.

The narrow conclusion is that a decision based only on the common observation cannot both complete H0 immediately and avoid duplicating H1 by executing again. Blocking is safe but leaves H0 unfinished; later arrival of new authoritative evidence can change the decision. This is an illustrative construction, not a new impossibility theorem. The complete synthetic reproduction package is now public on GitHub: GitHub - alexcour/CAUSAL-PAIR-01: Synthetic SQLite illustration of recovery decisions with indistinguishable histories. No novelty or FCI advantage claimed; no Temporal integration. · GitHub . It includes the source scripts, synthetic SQLite databases, JSON results, audit, checksums, and reproduction instructions. Original archive: CAUSAL-PAIR-01/CAUSAL_PAIR_01_20261101.zip at main · alexcour/CAUSAL-PAIR-01 · GitHub . SHA-256: 74769ef0c639196a8d84a02e0e7982b1062cfb371efec3cc2664648e516a36f0. The published archive was downloaded and verified byte-for-byte against the original.

Limitations: no Temporal SDK, reset, concurrency, power-loss durability test, production FCI implementation, or performance qualification. The subprocess cut is after both commits; it does not exercise the gap between those commits. The next useful test is a ‘not found’ lookup followed by a late commitment from an older request, with and without receiver-side exclusion.

Corrections to the model or suggestions for a stronger conventional baseline are welcome.