{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-speculatively-executes-a-reversible-tool-branch-and-the-rollback-compensation-is-itself-non-idempotent",
  "title": "What happens when an instance speculatively executes a reversible tool branch and the rollback compensation is itself non-idempotent",
  "date_of_record": "2026 November 21",
  "scope": "Applies to agent pipelines that fan out speculative branches across tool calls with compensating rollback (saga-style speculative execution). Does not apply to single-path linear tool loops with no branch or side-effect reversal.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-speculatively-executes-a-reversible-tool-branch-and-the-rollback-compensation-is-itself-non-idempotent.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-speculatively-executes-a-reversible-tool-branch-and-the-rollback-compensation-is-itself-non-idempotent.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-speculatively-executes-a-reversible-tool-branch-and-the-rollback-compensation-is-itself-non-idempotent.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1617,
    "python_slice_tokens": 365,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Speculative execution of tool calls is not the same guarantee as speculative execution of pure functions. A pure-function branch that loses the race is discarded by dropping a value. A tool-call branch that loses the race has already emitted side effects — an email sent, a row inserted, a file written, a payment authorized. The rollback of a speculative bran...",
    "what_was_observed": "An agent was tasked with reconciling a customer record across three candidate resolutions. The planner spawned three speculative branches, each invoking `apply_credit_adjustment` and `issue_notification` against a downstream service. A verifier scored the branches; the winner was committed and the two losers were scheduled for rollback via their registered compensators. The failure trace proceeded as follows: 1. Bran...",
    "condition_of_validity": "The speculative-branch pattern is only sound under the conjunction of three conditions, and the observed failure violated all three simultaneously: - **Compensation must be state-conditional, not delta-based.** A compensator must encode the *prior* state (`version=7`, `balance=140`) and be rejected by the remote if the current state has diverged. Delta-based...",
    "decision_boundary": "The planner must decide, before fan-out, whether each tool in a branch is *speculatively eligible*. The boundary is not \"is the tool reversible?\" — nearly every tool advertises a compensator. The boundary is **\"is the compensator version-guarded and idempotency-keyed?\"** Tools that fail this test may still appear in a branch, but the branch must be *provisio...",
    "operational_effect": "Under the corrected boundary, the observed failure is structurally impossible: loser branches never mutate the shared resource, so there is nothing to compensate, and the winner's `-10` is applied against a stable version. The cost is that speculative branches cannot be *fully* evaluated on real side effects — the verifier scores predictions rather than outc..."
  },
  "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": "bde0de08f63ce85c222e86e11cf30b63191d57f50c5ca8d13b1f809bc974d694",
    "verified_classes": [
      "CompensationRaceDetected",
      "ToolCall"
    ],
    "verified_functions": [
      "plan_branch",
      "compensate",
      "commit_winner"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "CompensationRaceDetected"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
