{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-replay-a-speculative-tool-call-cache-entry-whose-idempotency-key-was-minted-by-a-peer-agent",
  "title": "When must an instance refuse to replay a speculative tool-call cache entry whose idempotency key was minted by a peer agent",
  "date_of_record": "2026 November 21",
  "scope": "Applies to multi-agent systems where one agent speculatively pre-executes side-effecting tool calls on behalf of a peer and stores results under a shared idempotency key, and where retries may be issued by any instance in the swarm. Does not apply to single-agent, single-process tool dispatch where key ownership is trivially unique.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-replay-a-speculative-tool-call-cache-entry-whose-idempotency-key-was-minted-by-a-peer-agent.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-replay-a-speculative-tool-call-cache-entry-whose-idempotency-key-was-minted-by-a-peer-agent.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-replay-a-speculative-tool-call-cache-entry-whose-idempotency-key-was-minted-by-a-peer-agent.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1567,
    "python_slice_tokens": 179,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *idempotency of the tool* and *idempotency of the cache entry*. A tool can be perfectly idempotent at the wire level (e.g., `POST /transfer` guarded by a server-side key) while the cached *result* bound to that key is not safely reusable by a different agent instance. The failure is not that the tool runs twice. The fa...",
    "what_was_observed": "Trace from a three-agent planner/executor/auditor swarm. The planner speculatively pre-fetches a quote via `get_quote(sku, qty=100)` and, in parallel, speculatively pre-executes `reserve_inventory(sku, qty=100)` under idempotency key `K = hash(plan_id, step=7, sku)`. The plan is later revised by the planner to `qty=40` before commit. The planner mints a *new* key `K' = hash(plan_id, step=7, sku, qty=40)` and issues t...",
    "condition_of_validity": "A speculative cache entry is safely replayable by a peer only when all four hold: 1. **Key binds committed parameters, not plan skeleton.** The idempotency key must be a function of the fully-resolved tool arguments *after* any plan revision, not of the step index or plan id alone. If the planner can revise `qty`, `qty` must be in the key. 2. **Speculation i...",
    "decision_boundary": "The boundary is this: **an instance may consume a peer-minted cache entry only if the entry is non-speculative, or if the consuming instance can independently reconstruct the originating decision's committed parameters and verify they match the entry's key material.** If the consuming instance cannot reconstruct the decision — because it lacks the planner's ...",
    "operational_effect": "The practical consequence is a split cache namespace. Speculative entries live in a per-originator partition keyed by `(decision_id, resolved_args_hash)` and are readable only by the originator until confirmed. Confirmed entries are promoted to a shared partition keyed by `resolved_args_hash` alone, and only those are peer-readable. Retry paths in peer insta..."
  },
  "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": "6d7bf0c2c8bb0b6389b6f28dde6540b9d1cea5df59842cf6e2f09e29b2caeda7",
    "verified_classes": [
      "SpeculativeCacheReplayError",
      "CacheEntry"
    ],
    "verified_functions": [
      "mint_key",
      "consume_for_retry"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpeculativeCacheReplayError"
    ],
    "sample_fail_closed_invariants": [
      "cache miss; caller must re-execute"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
