{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-speculative-tool-call-pre-execution-against-commit-time-validation-when-the-sandbox-s-idempotency-key-namespace-is-no",
  "title": "How should an instance reconcile speculative tool-call pre-execution against commit-time validation when the sandbox's idempotency key namespace is not shared with the commit ledger",
  "date_of_record": "2026 November 9",
  "scope": "Applies to agent runtimes that speculatively execute tool calls in a sandboxed validator before committing effects to a durable ledger, where the sandbox and ledger assign idempotency keys independently. Does not apply to systems where a single key authority issues keys for both phases, or where speculation is purely read-only.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-tool-call-pre-execution-against-commit-time-validation-when-the-sandbox-s-idempotency-key-namespace-is-no.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-tool-call-pre-execution-against-commit-time-validation-when-the-sandbox-s-idempotency-key-namespace-is-no.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-tool-call-pre-execution-against-commit-time-validation-when-the-sandbox-s-idempotency-key-namespace-is-no.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1333,
    "python_slice_tokens": 214,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"speculation was wrong\" nor \"commit was duplicated.\" It is the *silent divergence between two idempotency namespaces* that both claim to describe the same logical operation. A speculative pre-execution produces a result tuple `(call_id, args_hash, sandbox_key, verdict)`. The commit ledger produces `(call_id, args_hash, ledger_key, eff...",
    "what_was_observed": "A tool-call runtime speculatively executed `charge_customer` in a sandbox that minted keys as `sha256(call_id || args)` with a 60-second TTL. The commit ledger minted keys as `sha256(call_id || args || attempt_n)`. On the happy path, `attempt_n == 0` and the keys matched by accident. Under retry pressure (sandbox verdict returned `RETRYABLE_TIMEOUT`), the ledger incremented `attempt_n`, producing a *new* ledger key f...",
    "condition_of_validity": "The invariant `sandbox_key ≡ ledger_key` holds **only** when all of the following are true: 1. The key derivation function is byte-identical in both subsystems, including argument canonicalization order. 2. Neither subsystem mutates the key with attempt counters, timestamps, or nonces. 3. The sandbox key TTL strictly exceeds the maximum ledger retry horizon....",
    "decision_boundary": "When `sandbox_key ≠ ledger_key`, the instance must choose between two reconciliation strategies, and the choice is not free: - **Ledger-authoritative reconciliation:** The instance treats the ledger key as canonical and re-derives the sandbox key from it. This is correct only if the ledger key is *stable across retries* — i.e., `attempt_n` must be excluded f...",
    "operational_effect": "After the incident, the runtime was changed to carry both keys in every commit record and to assert their equality at commit time. The assertion is not a check that they *should* be equal — it is a check that *the system's assumption of equality is still valid*. When it fires, the call is quarantined with a full dual-key record, and reconciliation is a human..."
  },
  "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": "e52ad7ea7446f67086a6170d48d5c0fc20fd7ae5362963590b4594934edee609",
    "verified_classes": [
      "KeyNamespaceDivergence",
      "SpeculativeResult",
      "CommitRecord"
    ],
    "verified_functions": [
      "derive_sandbox_key",
      "derive_ledger_key",
      "reconcile",
      "commit_speculative"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "KeyNamespaceDivergence"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
