{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-invalidate-a-speculative-branch-s-optimistic-tool-effects-before-rollback-and-how-does-the-commit-window-invariant",
  "title": "In what scenarios must an instance invalidate a speculative branch's optimistic tool effects before rollback, and how does the commit-window invariant bound the damage",
  "date_of_record": "2026 November 23",
  "scope": "Applies to any orchestrator that fans a task into parallel speculative branches, each of which may invoke side-effecting tools optimistically (write, send, charge, deploy) before a branch is selected. Does not apply to read-only tool sets or to branches whose tools are all transactional and externally idempotent under a shared dedup key.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-invalidate-a-speculative-branch-s-optimistic-tool-effects-before-rollback-and-how-does-the-commit-window-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-invalidate-a-speculative-branch-s-optimistic-tool-effects-before-rollback-and-how-does-the-commit-window-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-invalidate-a-speculative-branch-s-optimistic-tool-effects-before-rollback-and-how-does-the-commit-window-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1860,
    "python_slice_tokens": 297,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct notions of \"rollback\" in a speculative multi-agent executor, and conflating them is the root cause of nearly every corruption incident in this class: - **State rollback** — restoring the agent's *internal* context, scratchpad, and working-memory checkpoint to the pre-branch snapshot. This is cheap, deterministic, and always safe. The L...",
    "what_was_observed": "A three-branch speculative planner was tasked with \"provision a staging environment for customer C.\" Each branch chose a different provider sequence. All three branches ran optimistically because the planner had learned that waiting for selection serialized latency unacceptably. Each branch's first tool call was `allocate_quota(customer, region)` — an optimistic reservation against a finite regional pool. Trace of th...",
    "condition_of_validity": "State rollback is a sufficient substitute for effect rollback *only* when all of the following hold for every tool a branch may optimistically invoke: 1. **Effect is compensable and the compensation is cheap and idempotent.** A `reserve` with a `release` counterpart qualifies; a `send_email` does not. 2. **The compensation lease outlives the maximum branch-s...",
    "decision_boundary": "The operative decision is: **at the moment of branch selection, is each non-selected branch's effect set (i) empty, (ii) fully compensable within lease, or (iii) partially durable?** - Case (i): plain state rollback. Safe. - Case (ii): issue compensations *before* declaring the branch discarded, and only mark `discarded` after every compensation returns ackn...",
    "operational_effect": "Concretely, three changes bound the damage: 1. **Effect ledger separate from context ledger.** Every optimistic tool call appends `(branch_id, tool, effect_id, compensable_until, compensation_handle)` to an orchestrator-owned durable ledger *before* the call returns. Rollback reads the ledger, never the branch's self-report. 2. **Selection must re-check the ..."
  },
  "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": "c5b68ef61dff3340407c8e6b32194b83ef7746b23c89c89c18ee6705c275b8ec",
    "verified_classes": [
      "CommitWindowViolation",
      "EffectEntry",
      "EffectLedger"
    ],
    "verified_functions": [
      "rollback_branch",
      "__init__",
      "record",
      "entries"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CommitWindowViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
