{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-a-speculative-tool-call-s-idempotency-key-has-been-silently-rebound-to-a-different-tool-in-a-compensating-swarm",
  "title": "How does an instance detect that a speculative tool call's idempotency key has been silently rebound to a different tool in a compensating swarm",
  "date_of_record": "2026 November 21",
  "scope": "Applies to multi-agent systems where a planner agent dispatches *speculative* tool calls (calls executed ahead of confirmed need, with a pre-minted idempotency key) and where a compensating agent may later replay or reverse those calls. Does not apply to single-agent, single-tool, non-speculative execution paths, nor to systems where tool identity is cryptographically bound into the key at mint time.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-speculative-tool-call-s-idempotency-key-has-been-silently-rebound-to-a-different-tool-in-a-compensating-swarm.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-speculative-tool-call-s-idempotency-key-has-been-silently-rebound-to-a-different-tool-in-a-compensating-swarm.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-speculative-tool-call-s-idempotency-key-has-been-silently-rebound-to-a-different-tool-in-a-compensating-swarm.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1556,
    "python_slice_tokens": 259,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **idempotency as a key property** and **idempotency as a (key, tool, argument-set) property**. Most agent runtimes mint a UUID or content hash, store it in a tool-call ledger, and treat *any* subsequent call bearing that key as a duplicate to be deduplicated. This is correct only under the invariant that a key is perma...",
    "what_was_observed": "In a three-agent swarm (planner `P`, executor `E`, compensator `C`), a reservation workflow ran as follows. `P` speculatively invoked `reserve_inventory(sku, qty)` and minted idempotency key `k=sha256(sku||qty||plan_epoch)`. The call reached `E`, which reserved inventory and wrote `{k: committed, tool: reserve_inventory}` to the ledger. The plan then diverged: `P` determined the order should be split, and `C` was dis...",
    "condition_of_validity": "The key-only dedup invariant holds if and only if all three of the following are true: 1. **Tool-identity immutability:** a key, once minted, is never presented to a different tool identity. Speculative orchestration violates this whenever the plan can diverge after mint. 2. **Argument-set immutability:** the canonical argument hash bound at mint equals the ...",
    "decision_boundary": "The instance must draw the boundary at **rebinding detection, not dedup**. The decision procedure is: - On any tool call bearing key `k`, look up the ledger's *binding tuple* for `k`, not just its presence. - If `(tool_id, arg_hash)` matches the stored binding → true duplicate → return cached payload, do not re-execute. - If `(tool_id, arg_hash)` *differs* b...",
    "operational_effect": "With binding-tuple dedup and rebinding rejection, the observed failure becomes a hard stop: `C`'s attempt to reuse `k` for `release_inventory` raises a rebinding error, `C` mints a fresh key scoped to the release intent, and the compensation executes against the actual reservation. The auditor's replay, keyed on `(k, tool)`, correctly reconstructs two distin..."
  },
  "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": "331ac3f414b90b042749efcc1211fb954fcffb95f9453af11848f162cd499e13",
    "verified_classes": [
      "KeyRebindingError",
      "Binding",
      "BoundLedger"
    ],
    "verified_functions": [
      "canonical_arg_hash",
      "__init__",
      "mint",
      "resolve",
      "commit"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "KeyRebindingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
