{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-speculatively-invokes-a-side-effecting-tool-across-a-rollback-boundary-and-the-compensating-action-is-itself-non-idempot",
  "title": "What happens when an instance speculatively invokes a side-effecting tool across a rollback boundary and the compensating action is itself non-idempotent",
  "date_of_record": "2026 December 1",
  "scope": "Applies to orchestrators that run speculative branch-and-prune rollouts across multiple agent instances where branches may optimistically invoke external tools (writes, sends, payments, state mutations) and rely on compensating actions to isolate side effects before a branch is pruned. Does not apply to read-only tool surfaces or to single-branch linear execution where no branch is ever discarded after a side effect has fired.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-speculatively-invokes-a-side-effecting-tool-across-a-rollback-boundary-and-the-compensating-action-is-itself-non-idempot.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-speculatively-invokes-a-side-effecting-tool-across-a-rollback-boundary-and-the-compensating-action-is-itself-non-idempot.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-speculatively-invokes-a-side-effecting-tool-across-a-rollback-boundary-and-the-compensating-action-is-itself-non-idempot.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1624,
    "python_slice_tokens": 210,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The naive mental model of optimistic speculative execution treats rollback as a symmetric inverse: if branch B invoked tool T with arguments A, pruning B triggers a compensating invocation T⁻¹(A) that restores the pre-branch world. This model holds only when T is *invertible* and T⁻¹ is *idempotent*. The failure mode that matters at the agent layer is subtle...",
    "what_was_observed": "A planner instance spawns three speculative branches to satisfy a user request (\"reconcile the invoice and notify the vendor\"). Branch A (the eventual winner) plans to issue a credit memo. Branch B optimistically invokes `send_email` to the vendor with a draft reconciliation notice, then is pruned when the auditor scores A higher. The orchestrator dispatches a rollback instruction to B's executor: \"undo the send.\" B'...",
    "condition_of_validity": "This failure requires the conjunction of four conditions, and the guardrail must be evaluated against all four: - **Optimism:** the branch invokes a side-effecting tool *before* the branch is selected (i.e., during exploration, not after commit). - **Pruning after effect:** the branch is discarded after the effect has fired, so rollback is required rather th...",
    "decision_boundary": "The architectural invariant is: **a branch may not cross the side-effect boundary until it has been selected, unless the tool declares a verifiable, idempotent compensator in its capability manifest.** Operationally this splits into three enforceable rules: 1. **Effect gating.** Speculative branches run against a *shadow* tool surface (dry-run, sandboxed, or...",
    "operational_effect": "When the invariant is violated, the observable symptoms are: duplicate external effects (messages, charges, tickets), a scheduler that reports clean rollbacks for dirty branches, and downstream auditors that flag state surplus against expected counts. The blast radius scales with the number of speculative branches per tool and the retry aggressiveness of the..."
  },
  "matched_failure_symptoms": [
    "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": "f22fd9b0a404445de1748e563cf9635f858bccccdf34c12de01ff85cbd7456ab",
    "verified_classes": [
      "RollbackBoundaryViolation",
      "ToolCapability",
      "BranchState"
    ],
    "verified_functions": [
      "assert_rollback_safe"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "RollbackBoundaryViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
