{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-prefetches-a-tool-call-under-a-stale-idempotency-key-and-the-reconciliation-ledger-cannot-distinguish-a-replay-from-a-ne",
  "title": "What happens when an instance prefetches a tool call under a stale idempotency key and the reconciliation ledger cannot distinguish a replay from a new intent",
  "date_of_record": "2026 November 21",
  "scope": "Applies to any agent runtime that speculatively dispatches tool calls ahead of the reasoning step that would have authorized them, using client-generated idempotency keys to enforce exactly-once side effects. Does not apply to purely read-only tools or to runtimes that serialize all tool dispatch behind a single blocking reasoning gate.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prefetches-a-tool-call-under-a-stale-idempotency-key-and-the-reconciliation-ledger-cannot-distinguish-a-replay-from-a-ne.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prefetches-a-tool-call-under-a-stale-idempotency-key-and-the-reconciliation-ledger-cannot-distinguish-a-replay-from-a-ne.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prefetches-a-tool-call-under-a-stale-idempotency-key-and-the-reconciliation-ledger-cannot-distinguish-a-replay-from-a-ne.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1672,
    "python_slice_tokens": 390,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a speculative call was wrong\" — speculative calls are expected to be wrong sometimes, and the runtime is designed to discard them. The failure is that the *idempotency key was minted at the wrong point in the causal chain*. A key is a promise about intent identity: \"these two transmissions mean the same thing.\" When an agent generates the...",
    "what_was_observed": "An agent running a multi-step task (a payment adjustment workflow) used a prefetcher that, upon reading a partially-filled plan, dispatched `apply_credit(account, amount)` speculatively. The key was derived deterministically as `hash(plan_id || step_index || tool_name || canonical_args)`. The plan was later revised by the reasoning loop: the amount changed from 40 to 45 because a prior tool call returned a discount t...",
    "condition_of_validity": "The invariant \"same idempotency key ⇒ same intent\" holds only if the key is a pure function of state that is *monotonic across the task*. In practice this requires all three: 1. **Key derivation must include a context epoch or plan version** that increments on any revision to the plan fragment the call depends on. `hash(plan_id || step_index || args)` is ins...",
    "decision_boundary": "The runtime must choose, on every duplicate-key hit, between *suppress* (assume replay) and *reconcile* (query authoritative state). The boundary is: - **Suppress** only when the prior entry is `CONFIRMED` with a terminal provider response, or `IN_FLIGHT` with a heartbeat younger than the provider's documented execution window. - **Reconcile** whenever the p...",
    "operational_effect": "Without the epoch in the key and the `UNCONFIRMED`/`IN_FLIGHT` split, prefetching converts a latency optimization into a silent correctness hazard: side effects land exactly once but attach to superseded intents, and the discrepancy is invisible until external reconciliation days later. The blast radius scales with prefetch depth — deeper speculation means m..."
  },
  "matched_failure_symptoms": [
    "DUPLICATE_MUTATION_OR_BILLING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "bec02e97fdc621d53cae82d029779dce3bde55ec4753656110ed94588eaaa7ea",
    "verified_classes": [
      "IdempotencyCollisionError",
      "LedgerState",
      "LedgerEntry",
      "ReconciliationLedger"
    ],
    "verified_functions": [
      "derive_key",
      "dispatch",
      "confirm"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "IdempotencyCollisionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
