{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-branch-merge-from-resurrecting-rolled-back-tool-effects",
  "title": "Which invariants prevent speculative branch merge from resurrecting rolled-back tool effects",
  "date_of_record": "2026 November 29",
  "scope": "Applies to orchestrators that fan out a single planning step into N parallel speculative agent branches (different tool-call orderings, different retrieval strategies, or different sub-plans), then select a winner and roll back or merge the losers. Does not apply to single-branch sequential agents, nor to branches that are read-only and side-effect-free.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-merge-from-resurrecting-rolled-back-tool-effects.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-merge-from-resurrecting-rolled-back-tool-effects.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-merge-from-resurrecting-rolled-back-tool-effects.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2376,
    "python_slice_tokens": 471,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure discussed here is not \"a branch produced a wrong answer.\" It is that **speculative fan-out makes the observable world a function of the union of branches, not the winner**. Rollback of a branch's *state* (its message history, its scratchpad, its claimed plan) is cheap and well understood. Rollback of a branch's *external effects* — files written,...",
    "what_was_observed": "A planning agent was asked to reconcile a customer's billing discrepancy. The orchestrator speculatively launched three branches: - **Branch A** (`conservative`): read ledger, read invoice, propose refund of $12.00. - **Branch B** (`aggressive`): read ledger, read invoice, propose refund of $48.00 (matched a different line item). - **Branch C** (`audit`): read ledger, read invoice, read dispute ticket, propose no ref...",
    "condition_of_validity": "The invariant that must hold for speculative fan-out with rollback to be sound: > **For every tool effect e produced by any branch b, e is observable in the committed world iff (b is the winner) AND (e is on the winner's commit path). No effect produced by a non-winner may reach the committed world, regardless of the order in which effects serialize.** This ...",
    "decision_boundary": "The orchestrator must make a per-tool decision *before* fan-out, not after: The boundary is crossed the moment a tool that *looks* reversible (a \"draft\" that can be discarded) contains a sub-action that is irreversible (promote). The orchestrator cannot rely on tool names or on branch self-reports. It must rely on a **declared effect class** attached to each...",
    "operational_effect": "Concretely, the guardrail is a three-part protocol: 1. **Effect-class declaration at registration.** Every tool is registered with `effect_class ∈ {branch_reversible, resource_reversible, irreversible}`. The registry rejects tools with `irreversible` class from being added to a speculative branch's toolset. 2. **Effect log with branch provenance.** Every res..."
  },
  "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": "c85abc6059eb5e5cf34dbd5b6a2e8893bf37b6fd846ad27917cd8833880d6fda",
    "verified_classes": [
      "EffectClass",
      "IrreversibleInSpeculativeBranch",
      "QuiesceTimeout",
      "EffectEntry",
      "ToolRegistry",
      "Branch",
      "Orchestrator"
    ],
    "verified_functions": [
      "register",
      "class_of",
      "__init__",
      "call_tool",
      "rollback",
      "quiesce",
      "commit"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "IrreversibleInSpeculativeBranch",
      "KeyError",
      "QuiesceTimeout"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
