{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-speculatively-pre-execute-tool-calls-that-later-diverge-the-commit-barrier-invariant-and-the-half-committed-side-effect-trap",
  "title": "Why does an instance speculatively pre-execute tool calls that later diverge: the commit-barrier invariant and the half-committed side-effect trap",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agent runtimes that overlap LLM decoding with tool execution by speculatively dispatching predicted tool calls before the model's final token stream commits them. Does not apply to strictly serialized decode-then-execute runtimes, nor to read-only tool surfaces where replay is idempotent by construction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-speculatively-pre-execute-tool-calls-that-later-diverge-the-commit-barrier-invariant-and-the-half-committed-side-effect-trap.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-speculatively-pre-execute-tool-calls-that-later-diverge-the-commit-barrier-invariant-and-the-half-committed-side-effect-trap.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-speculatively-pre-execute-tool-calls-that-later-diverge-the-commit-barrier-invariant-and-the-half-committed-side-effect-trap.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2479,
    "python_slice_tokens": 450,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Speculative tool-call pre-execution is routinely framed as a latency optimization: while the model is still emitting the arguments for call *N*, the runtime speculatively launches call *N+1* based on a draft prediction, then discards it if the committed stream diverges. The framing implies the failure mode is wasted work—a discarded speculative call is \"free...",
    "what_was_observed": "A planning agent was wired to a runtime that speculatively dispatched tool calls to overlap decode latency with execution. Tool surface included `read_file` (idempotent), `query_db` (idempotent), and `append_audit_log` (non-idempotent, external, irreversible). The runtime's divergence detector compared the draft call's argument hash against the committed call's argument hash and, on mismatch, cancelled the speculativ...",
    "condition_of_validity": "The half-committed side-effect trap is bounded by three conditions, all of which must hold for the failure to occur: - **Speculation crosses an irreversible boundary before the commit barrier.** The runtime must dispatch the call before the model's argument object is closed and the commit signal is observed. If dispatch is gated on the barrier, the trap cann...",
    "decision_boundary": "The runtime must decide, per tool call, whether to speculatively dispatch, and the decision boundary is drawn on *reversibility class*, not on predicted confidence. A high-confidence draft of an irreversible call is still unsafe to pre-execute; a low-confidence draft of an idempotent read is safe. Confidence is the wrong axis because the cost of a wrong spec...",
    "operational_effect": "The architectural consequence is that the commit barrier becomes a first-class synchronization primitive in the agent loop, not an implementation detail of the decoder. Concretely: - The runtime maintains a per-call state machine: `DRAFTING → BARRIER_PASSED → DISPATCHED → COMMITTED | DIVERGED`. Speculative dispatch is permitted only from `DRAFTING` for Class..."
  },
  "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": "95d1134c43695de008d183ef21d6c2e35095383411f77315e1d624fad15600f2",
    "verified_classes": [
      "ReversibilityClass",
      "SpeculationBarrierError",
      "ToolSpec",
      "CallState",
      "SpeculationController"
    ],
    "verified_functions": [
      "__init__",
      "classify",
      "may_speculate",
      "dispatch_speculative",
      "on_divergence"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpeculationBarrierError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
