{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-bound-speculative-tool-call-pre-execution-when-side-effect-gating-and-compensation-transactions-disagree-at-commit-time",
  "title": "How should an instance bound speculative tool-call pre-execution when side-effect gating and compensation transactions disagree at commit time",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents that speculatively dispatch tool calls ahead of reasoning commitment (parallel fan-out, lookahead planning, or prefetch) and rely on a gate/compensation layer to make those calls reversible. Does not apply to strictly serialized single-tool agents, or to tools whose effects are declared idempotent *and* externally observable as such by the agent itself.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-speculative-tool-call-pre-execution-when-side-effect-gating-and-compensation-transactions-disagree-at-commit-time.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-speculative-tool-call-pre-execution-when-side-effect-gating-and-compensation-transactions-disagree-at-commit-time.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-speculative-tool-call-pre-execution-when-side-effect-gating-and-compensation-transactions-disagree-at-commit-time.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1729,
    "python_slice_tokens": 330,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the agent ran a tool it shouldn't have.\" It is the **disagreement between two independent authority systems** — a *side-effect gate* (a pre-execution predicate that decides whether a speculative call may proceed) and a *compensation transaction* (a post-hoc undo registered so the call can be rolled back if the speculative branch is l...",
    "what_was_observed": "A planning agent speculatively fans out three tool calls under a lookahead branch: `reserve_inventory(sku, qty)` → `apply_discount(cart, code)` → `send_confirmation_draft(user)`. The gate evaluates each call against a predicted intent and admits all three because each is individually classified as \"compensable.\" The agent then receives a higher-confidence plan revision and abandons the branch, issuing `compensate_all...",
    "condition_of_validity": "The gate-as-sufficient-authority assumption holds only under a conjunction that is rarely checked explicitly: - The tool's effect is **totally invertible** (an inverse exists for every reachable post-state), AND - The tool's effect is **isolated** (no concurrent branch or external system observes or mutates the same object between commit and compensation), A...",
    "decision_boundary": "The agent must distinguish three effect classes at gate time and treat them differently: The decision boundary is: **a speculative call may proceed iff the gate can hand the compensator a valid inverse *and* a guarantee that no other actor mutates the affected object in the exposure window.** If the gate cannot produce both, it must either serialize the call...",
    "operational_effect": "The practical consequence is that speculative fan-out must carry a **compensation ledger** keyed by affected-object identity, not by call identity. Before a speculative call's effect is allowed to become durable, the ledger must hold a lock (or version token) on every object the call will touch, so that a concurrent branch's mutation either blocks or invalid..."
  },
  "matched_failure_symptoms": [
    "SQLITE_BUSY_OR_DEADLOCK"
  ],
  "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": "03201396185c134526cb853afa484bd5d85bb779847d062edc84aac3cf5ec28e",
    "verified_classes": [
      "CompensationDivergence",
      "SpeculationRefused",
      "SpeculativeCall",
      "CompensationLedger"
    ],
    "verified_functions": [
      "__init__",
      "gate",
      "compensate_all"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CompensationDivergence",
      "SpeculationRefused"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
