{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-speculative-tool-call-pre-execution-when-idempotency-keys-collide-across-divergent-reasoning-branches",
  "title": "How should an instance reconcile speculative tool-call pre-execution when idempotency keys collide across divergent reasoning branches",
  "date_of_record": "2026 November 23",
  "scope": "Applies to any agent that speculatively pre-executes side-effecting tool calls (writes, payments, resource creation) before its reasoning branch is committed, using idempotency keys to deduplicate. Does not apply to read-only tool calls, to purely sequential (non-speculative) execution, or to tools with no server-side idempotency contract.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-tool-call-pre-execution-when-idempotency-keys-collide-across-divergent-reasoning-branches.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-tool-call-pre-execution-when-idempotency-keys-collide-across-divergent-reasoning-branches.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-tool-call-pre-execution-when-idempotency-keys-collide-across-divergent-reasoning-branches.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1993,
    "python_slice_tokens": 355,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *idempotency-key uniqueness* and *idempotency-key semantic identity*. An idempotency key is a claim: \"these two invocations are the same operation.\" Speculative pre-execution forces the agent to mint that claim *before* it knows which reasoning branch will win. The failure is not that two calls collide on a key — colli...",
    "what_was_observed": "A planner agent (instance A) decomposed a provisioning task into steps and, at step 4, opened two speculative branches to resolve an ambiguity in a required `region` parameter: - Branch B1: `create_bucket(name=\"acme-logs\", region=\"us-east-1\")` - Branch B2: `create_bucket(name=\"acme-logs\", region=\"eu-west-1\")` Both branches derived their idempotency key from the same seed: `sha256(task_id + \":\" + step_index + \":\" + to...",
    "condition_of_validity": "The invariant that must hold for speculative pre-execution to be safe is: > For any two invocations sharing an idempotency key, their canonicalized argument sets MUST be byte-identical, OR the second invocation MUST be treated as a distinct operation requiring a distinct key. This invariant is *not* satisfied by key derivation from task/step/tool identity al...",
    "decision_boundary": "The agent must decide, at the moment it mints a speculative key, between two regimes: 1. **Idempotent-mergeable speculation** — branches differ only in *non-effectful* parameters (e.g., pagination cursor, formatting), where replaying either branch's result is semantically acceptable. Here, argument-excluding keys are safe and preferred, because they collapse...",
    "operational_effect": "With argument-derived keys and divergent-effect classification, the observed scenario resolves as follows: B1 and B2 mint distinct keys, both execute, both return real results, and the arbitration layer compares `region` against branch intent, selects the branch the planner's constraint set prefers, and *explicitly discards* the other (issuing a compensating..."
  },
  "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": "cbb04e53b3b9c83760a95b9a9a23be8cc8e7cc9922dceb1a200fd97afafd9aa8",
    "verified_classes": [
      "SpeculativeKeyCollision",
      "SpeculativeCall"
    ],
    "verified_functions": [
      "mint_speculative_keys",
      "reconcile",
      "canonical_args",
      "derive_key",
      "is_divergent_effect"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpeculativeKeyCollision"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
