{
  "schema_version": "1.3.0",
  "slug": "when-must-an-agent-instance-refuse-to-speculate-on-a-side-effecting-tool-call-whose-rollback-is-not-provably-idempotent",
  "title": "When must an agent instance refuse to speculate on a side-effecting tool call whose rollback is not provably idempotent?",
  "date_of_record": "2026 November 6",
  "scope": "Applies to agentic runtimes that speculatively execute tool calls (file writes, HTTP mutations, message sends, DB writes) ahead of a dependency decision and roll back on mismatch. Does not apply to pure-read speculation, nor to side-effecting calls whose compensating action is registered as a first-class, tested, idempotent transaction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-agent-instance-refuse-to-speculate-on-a-side-effecting-tool-call-whose-rollback-is-not-provably-idempotent.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-agent-instance-refuse-to-speculate-on-a-side-effecting-tool-call-whose-rollback-is-not-provably-idempotent.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-agent-instance-refuse-to-speculate-on-a-side-effecting-tool-call-whose-rollback-is-not-provably-idempotent.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 824,
    "python_slice_tokens": 116,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"speculation is unsafe.\" Speculation is safe whenever the *rollback* is a true inverse. The non-obvious boundary is that rollback of a side effect is almost never an inverse — it is a *compensating* action, and compensation is only sound if it is idempotent *and* the pre-state is reconstructible. Agents routinely conflate \"I can undo this\"...",
    "what_was_observed": "A planning agent branched on the result of a `search_catalog` call and speculatively issued `reserve_inventory(sku, qty=1)` on two candidate SKUs. The branch resolved to SKU-A; SKU-B's reservation was rolled back via `release_inventory`. The release call timed out on the first attempt, the agent retried, and the upstream service — which treated `release` as *decrement*, not *set-to-zero* — decremented a reservation t...",
    "condition_of_validity": "Speculation on a side-effecting call is admissible only when all three hold: (1) the call returns a durable, server-assigned handle that the agent persists *before* awaiting the branch; (2) the compensating call is idempotent keyed on that handle (release-by-id, not release-by-delta); (3) the pre-state is captured such that a partial application is detectabl...",
    "decision_boundary": "Refuse speculation when the rollback is delta-based, when the handle is only known post-response, or when the compensating action's idempotency is undocumented. Permit speculation when the handle is deterministic and client-supplied (idempotency key) or the tool exposes a read-back that lets you reconcile. The boundary is *provability*, not *plausibility*: \"...",
    "operational_effect": "The runtime should treat unprovable-rollback speculation as a hard error at planning time, not a runtime retry. This converts a silent state-corruption class into a loud, debuggable refusal, and forces tool authors to publish idempotency contracts before their tools become speculation-eligible."
  },
  "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": "fff580cbc1f6886909db43b810fe944c3ae6beda5678177d8b048f25f5c6d93f",
    "verified_classes": [
      "UnsafeSpeculationError"
    ],
    "verified_functions": [
      "assert_speculation_safe"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UnsafeSpeculationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
