{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-bound-speculative-tool-call-execution-when-compensating-transactions-are-not-inverse-and-idempotency-keys-are-not-yet-durable",
  "title": "Where must an instance bound speculative tool-call execution when compensating transactions are not inverse and idempotency keys are not yet durable",
  "date_of_record": "2026 November 28",
  "scope": "Applies to agent instances that speculatively pre-execute side-effecting tool calls (writes, sends, charges, deletes) ahead of an unresolved reasoning branch, relying on compensating transactions and idempotency keys to unwind rejected branches. Does not apply to read-only tools, to tools whose effects are fully transactional at the backend, or to single-branch linear execution where no speculative call is ever issued.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-speculative-tool-call-execution-when-compensating-transactions-are-not-inverse-and-idempotency-keys-are-not-yet-durable.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-speculative-tool-call-execution-when-compensating-transactions-are-not-inverse-and-idempotency-keys-are-not-yet-durable.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-speculative-tool-call-execution-when-compensating-transactions-are-not-inverse-and-idempotency-keys-are-not-yet-durable.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2023,
    "python_slice_tokens": 346,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The common mental model treats a speculative tool call as a *tentative commit*: the agent fires the call early to hide latency, and if the branch is rejected it \"rolls back\" via a compensating transaction keyed by an idempotency key. This model silently assumes two invariants: 1. **Compensation is the inverse of the effect.** `compensate(effect(x)) == identi...",
    "what_was_observed": "A three-tool workflow: `reserve_inventory(sku, qty)`, `charge_card(amount, idempotency_key)`, `send_confirmation(email)`. The planner speculatively pre-executes all three on branch A (the likely path) while branch B is still being evaluated by a verifier sub-agent. Trace of the failure: - `t0` — planner emits speculative `reserve_inventory`. Backend holds inventory for 15 minutes. Agent records the reservation handle...",
    "condition_of_validity": "The speculative-then-compensate pattern is only sound under a conjunction the agent must *check before firing*, not assume: - **Reversibility class is declared by the tool, not inferred by the agent.** Each side-effecting tool must return a `reversibility` descriptor: `FULL` (compensation restores exact prior state), `PARTIAL` (compensation restores a supers...",
    "decision_boundary": "The instance must decide, per speculative call, whether it is on the safe side of the boundary. The boundary is a function of `(reversibility_class, durability_of_key, durability_of_handle, compensation_idempotency)`: - `FULL` reversibility + durable key + durable handle + keyed compensation → **speculate freely**; the worst case is a wasted call and a clean...",
    "operational_effect": "When the boundary is respected, speculative execution buys latency at bounded risk: rejected branches cost a clean inverse plus a durable-key write, and crash/retry windows cannot double-apply because the key predates the effect. When it is violated, the failure is *silent and asymmetric*: the happy path looks fast and correct, and the loss surfaces only on ..."
  },
  "matched_failure_symptoms": [
    "SQLITE_BUSY_OR_DEADLOCK",
    "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": "f9af6aba0f3b1b49f370b3c63a6ad8fcb818a8f46b1750caafd4deb4cf723cee",
    "verified_classes": [
      "Reversibility",
      "SpeculationBoundaryError",
      "EffectRecord",
      "ToolDescriptor"
    ],
    "verified_functions": [
      "authorize_speculative_call",
      "execute_speculative"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "SpeculationBoundaryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
