{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-abort-a-speculative-branch-whose-tool-side-effects-have-already-escaped-the-sandbox",
  "title": "When must an instance abort a speculative branch whose tool side-effects have already escaped the sandbox",
  "date_of_record": "2026 November 24",
  "scope": "Applies to orchestrators that fan out parallel speculative branches (each holding its own context fork and tool-call budget) and later commit one branch while aborting the rest, where at least one tool is non-idempotent and reaches an external system. Does not apply to pure-read tool fan-outs or to branches whose tools are fully transactional behind a compensating-rollback API.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-abort-a-speculative-branch-whose-tool-side-effects-have-already-escaped-the-sandbox.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-abort-a-speculative-branch-whose-tool-side-effects-have-already-escaped-the-sandbox.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-abort-a-speculative-branch-whose-tool-side-effects-have-already-escaped-the-sandbox.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2401,
    "python_slice_tokens": 440,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *logical rollback* and *physical rollback*. A speculative branch can be logically aborted at any instant—its context fork is discarded, its token budget is reclaimed, its partial reasoning trace is dropped. But a tool call that already crossed the sandbox boundary and mutated an external system (created a ticket, sent ...",
    "what_was_observed": "An orchestrator spawned three speculative branches for a customer-support task: Branch A proposed issuing a refund, Branch B proposed escalating to a human queue, Branch C proposed replying with a policy citation. Each branch ran in its own context fork with a shared tool budget. The tools available were `create_ticket`, `send_email`, `issue_refund`, and `lookup_policy`. `lookup_policy` is read-only; the other three ...",
    "condition_of_validity": "Logical abort is a valid rollback only under the following invariant, which must hold at the moment `abort()` is invoked on a branch: > For every tool call that branch has completed since its fork, either (a) the tool is idempotent and the winning branch's call will converge to the same external state, or (b) a compensator is registered and the orchestrator ...",
    "decision_boundary": "The decision boundary is: **does the orchestrator commit the winning branch, or reconcile first?** - If abort returns `clean`: commit the winner. The losing branches left no trace. - If abort returns `unknown`: the orchestrator must wait for the in-flight call to settle (bounded by the tool's timeout) before deciding. Committing while a losing branch has a c...",
    "operational_effect": "The practical consequence is that speculative fan-out over non-idempotent tools requires the abort protocol to carry an effect ledger, and the commit protocol to consult it. The ledger is per-branch, append-only, and records every completed tool call with its handle (ticket_id, message_id, refund_id) and its target object. The abort handler reads the ledger,..."
  },
  "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": "2f092cfb83f2ecb16729821f95f77a0728f49cdef936cd50a885ce9e76e89bf1",
    "verified_classes": [
      "AbortStatus",
      "DirtyAbortConflict",
      "EscapedEffect",
      "BranchLedger",
      "AbortResult"
    ],
    "verified_functions": [
      "abort_branch",
      "commit_winner",
      "record"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "DirtyAbortConflict"
    ],
    "sample_fail_closed_invariants": [
      "assert aborts[0].status is AbortStatus.DIRTY",
      "assert aborts[1].status is AbortStatus.DIRTY",
      "cannot commit: a losing branch has an in-flight tool call; wait for it to settle before deciding"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
