RFC-0003: Side-Effect Ledger and Replay Safety¶
Status: Draft Date: 2026-05-26 Depends on: docs/rfcs/RFC-0001-ORCA-RUNTIME-BLUEPRINT.md, docs/rfcs/RFC-0002-DURABLE-EXECUTION-STATE-MACHINE.md
1. Problem¶
Durable execution is unsafe if replay/resume can duplicate external actions.
Examples of unsafe duplication:
- Duplicate outbound email.
- Duplicate ticket creation.
- Duplicate payment or irreversible command.
2. Capability and Binding Semantics¶
2.1 Capability Runtime Fields¶
- side_effects: none | read | write | external_action
- idempotency: required | optional | not_supported
- replay_policy: use_recorded_result | reexecute | require_human
2.2 Binding Runtime Fields¶
- binding_call_id
- idempotency_key
- request_hash
- response_hash
- side_effect_status
Compatibility note: existing properties in capability specs remain valid; runtime semantics are canonical in SideEffectLedger during migration and after cutover.
3. SideEffectRecord¶
Minimum record shape:
- effect_id
- run_id
- step_id
- capability_id
- binding_id
- effect_class
- idempotency_key
- request_hash
- response_hash
- status (attempted, recorded, reused, blocked, failed)
- replay_policy
- recorded_result_ref
- created_at
- updated_at
4. Replay Policies¶
-
use_recorded_result Behavior: if idempotency key exists, return recorded result without external re-execution.
-
reexecute Behavior: execute external action again; create a new effect record.
-
require_human Behavior: transition run to waiting_for_human before external re-execution.
Default policy for external_action: use_recorded_result.
5. Integration Point in Execution Flow¶
SideEffectManager is called at step execution boundary when selected binding is side-effecting.
Order:
- Build idempotency key.
- Check ledger for existing matching entry.
- Apply replay policy.
- Execute or reuse.
- Record outcome and hashes.
6. Hashing Rules¶
- request_hash computed from normalized request payload.
- response_hash computed from normalized response payload when available.
- Hash function default: sha256.
7. Collision Notes and Decision Proposals¶
-
Current runtime binding metadata includes attempts and fallback metadata but no durable effect ledger. Decision: keep existing step metadata and append side_effect metadata references; SideEffectLedger becomes authoritative for effect history.
-
Current safety model uses requires_confirmation at capability level. Decision: integrate require_human replay policy with existing confirmation model; no separate non-durable behavior path after cutover.
-
Current audit records already include hashed step input/output snapshots. Decision: link audit records to SideEffectRecord IDs for cross-reference.
8. Acceptance Criteria¶
- Replay does not duplicate side effects under default policy.
- Operators can trace exactly when an effect was executed versus reused.
- Human approval boundary can be inserted before side-effect re-execution.