{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-tool-call-pre-execution-from-leaking-side-effects-before-commit-gating",
  "title": "Which invariants prevent speculative tool-call pre-execution from leaking side effects before commit gating",
  "date_of_record": "2026 November 23",
  "scope": "Applies to agents that speculatively pre-execute tool calls (parallel or ahead-of-need) under an effect-isolation layer with a commit gate. Does not apply to purely read-only tool surfaces or to agents that execute tools strictly serially with no speculation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-pre-execution-from-leaking-side-effects-before-commit-gating.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-pre-execution-from-leaking-side-effects-before-commit-gating.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-pre-execution-from-leaking-side-effects-before-commit-gating.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1777,
    "python_slice_tokens": 287,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways to make a speculative tool call \"safe,\" and conflating them is the root of the failure mode. The first is **effect isolation**: the call runs against a sandboxed or buffered effect target so that nothing observable to the outside world happens until commit. The second is **commit gating**: a decision point that either promotes the buffered...",
    "what_was_observed": "An agent was speculatively pre-executing a payment-intent tool (`create_payment_intent`) in parallel with a reasoning branch that had not yet decided whether to charge. The tool was wrapped by an isolation layer that intercepted the HTTP client and buffered the request body, deferring the actual `POST` until commit. On the \"abandon\" branch, the buffered request was discarded. The agent logged the speculative call as ...",
    "condition_of_validity": "Speculative pre-execution with commit gating is sound **only if all three hold**: - **Egress completeness:** every effect the tool can produce is either (a) routed through the isolation boundary, or (b) proven side-effect-free and commutable. Idempotency-key reservation, rate-limit accounting, nonce burning, cache population, and audit-log emission are all e...",
    "decision_boundary": "The decision to speculatively pre-execute a tool must be gated on a **static effect manifest** declared per tool, not on runtime observation. Runtime observation is too late: by the time you observe an unmodeled egress, the reservation is written. The boundary condition is: - If the tool's manifest declares `effects ⊆ modeled_effects` **and** the isolation w...",
    "operational_effect": "The practical consequence is a mandatory **nonce regeneration on commit** and a **manifest-completeness check before any speculative dispatch**. Without these, the agent exhibits a specific, reproducible pathology: it reports success for operations that never happened, and it does so *more* often as speculation parallelism increases, because more speculative..."
  },
  "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": "f3af5c1d99a433652690f110620d2ad7092c5ffd6709003d06e83f430d6e11d4",
    "verified_classes": [
      "SpeculationEgressViolation",
      "EffectManifest",
      "SpeculativeAttempt",
      "CommitGate"
    ],
    "verified_functions": [
      "is_speculation_safe",
      "__init__",
      "speculate",
      "commit",
      "discard"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpeculationEgressViolation"
    ],
    "sample_fail_closed_invariants": [
      "commit nonce equals speculative nonce; leaked reservations may alias"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
