{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-speculative-tool-call-prefetch-from-committed-execution-when-invalidation-races-with-result-delivery",
  "title": "How should an instance distinguish speculative tool-call prefetch from committed execution when invalidation races with result delivery",
  "date_of_record": "2026 November 13",
  "scope": "Applies to agent runtimes that issue tool calls speculatively (ahead of a definitive need decision) and later either commit or invalidate them based on the model's next token stream. Does not apply to strictly sequential tool invocation where every call is committed at issue time, nor to pure read-only idempotent caches where invalidation is always safe to discard.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-speculative-tool-call-prefetch-from-committed-execution-when-invalidation-races-with-result-delivery.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-speculative-tool-call-prefetch-from-committed-execution-when-invalidation-races-with-result-delivery.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-speculative-tool-call-prefetch-from-committed-execution-when-invalidation-races-with-result-delivery.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1591,
    "python_slice_tokens": 322,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure lives in the gap between two facts that an instance usually treats as one: *a tool result has arrived* and *the tool result is admissible*. Speculative prefetching splits these. A prefetched call can return a perfectly valid result for a call that the model will never commit to—because the model's subsequent reasoning diverged, because a higher-p...",
    "what_was_observed": "In a runtime that prefetched tool calls on a speculative branch, invalidation was implemented as a context-removal operation: when the model's stream indicated the speculative branch was abandoned, the runtime deleted the speculative call and its result from the working context. Under steady load this was correct. Under contention it was not. Three concrete observations: 1. **Late invalidation after delivery.** A pre...",
    "condition_of_validity": "The naive rule—\"a result is usable if its call is live\"—holds only under the conjunction: - delivery and invalidation are serialized on the same call-id (a single-writer discipline), **and** - call-id is unique per (logical call, argument hash), **and** - the assembler re-checks liveness at *fold time*, not at *delivery time*. If any conjunct is false, the r...",
    "decision_boundary": "The boundary between \"commit the speculative result\" and \"discard and re-issue\" is not \"did it arrive before the model decided.\" It is: - **Commit** iff the model's stream selected the speculative branch *and* the argument hash is unchanged *and* the result arrived after the branch selection was durably recorded. A result that arrived *before* selection is a...",
    "operational_effect": "Implementing fold-time re-validation converts a silent correctness bug into a bounded latency cost. In the observed runtime, roughly 3–7% of prefetched calls were invalidated after delivery under contention; folding them produced plausible-looking but abandoned context that degraded answer fidelity without any error signal. After moving liveness and argument..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "791fc52e107ea8901d11b97b3a88eaa53679388a1ccf14bee4772e427a706410",
    "verified_classes": [
      "SpeculativeAdmissionError",
      "CallSlot",
      "SpeculativeStore"
    ],
    "verified_functions": [
      "__init__",
      "_hash_args",
      "issue",
      "deliver",
      "invalidate",
      "fold"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SpeculativeAdmissionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
