{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-halt-a-speculative-branch-when-rollback-cannot-restore-an-externally-mutated-tool-state",
  "title": "Where must an instance halt a speculative branch when rollback cannot restore an externally mutated tool state?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to orchestrators that fork sibling agent branches speculatively (parallel candidate plans) and reconcile them by rollback/merge, where branches invoke side-effecting tools. Does not apply to read-only tool graphs or to single-branch linear execution where no reconciliation merge exists.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-halt-a-speculative-branch-when-rollback-cannot-restore-an-externally-mutated-tool-state.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-halt-a-speculative-branch-when-rollback-cannot-restore-an-externally-mutated-tool-state.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-halt-a-speculative-branch-when-rollback-cannot-restore-an-externally-mutated-tool-state.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2232,
    "python_slice_tokens": 507,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a branch produced a wrong answer.\" It is that a speculative branch treated *rollback of its own context and memory* as equivalent to *rollback of the world it touched*. These are separable state domains with different reversibility classes. An agent's internal state (message history, scratchpad, episodic buffer, tool-call log) is a versio...",
    "what_was_observed": "A planner agent decomposed a task into a fork point and launched three sibling branches (B1, B2, B3) over the same tool graph. Each branch was given a private context copy and a copy-on-write handle to a shared workspace. The orchestrator's invariant was stated as: *\"discarded branches are rolled back to the fork checkpoint.\"* B2 chose a path that called `send_notification(recipient, payload)` early — a tool whose co...",
    "condition_of_validity": "Rollback-based speculative reconciliation is valid **iff** every tool a branch may invoke is classified into one of three reversibility classes and the orchestrator enforces the class at the call boundary, not at merge time: 1. **Private** — effect confined to branch-local state (sandbox filesystem, branch-scoped KV, scratch memory). Rollback is exact; disca...",
    "decision_boundary": "The halt decision is a predicate evaluated at the tool-call boundary, not at branch termination: If true, the branch does not execute the call; it suspends, emits a `DeferredEffect` record, and yields to the reconciler. The reconciler either commits the branch (then the deferred effect fires) or discards it (the deferred effect never fires, and no compensati...",
    "operational_effect": "The orchestrator gained a tool-reversibility registry, a pre-effect compensation-intent log, and a `DeferredEffect` queue gated on commit. Speculative branches now terminate in one of three states: `DISCARDED_CLEAN` (only class-1 effects, exact rollback), `DISCARDED_COMPENSATED` (class-2 effects, compensation verified), or `UNRECONCILED` (compensation failed..."
  },
  "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": "7bb499ae22d81786472f35646548affad08c5d1035a24e0325d7261c63618fa0",
    "verified_classes": [
      "ReversibilityClass",
      "ForkState",
      "SpeculativeLeakError",
      "ToolContract",
      "Branch",
      "ForkPoint",
      "Reconciler"
    ],
    "verified_functions": [
      "__init__",
      "register_fork",
      "invoke_tool",
      "discard",
      "commit",
      "_compensate"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "SpeculativeLeakError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
