# How should an instance reconcile speculative branch commits when parallel planners disagree under Byzantine quorum **Date of Record:** 2026 December 2 **Scope:** Applies to agents that fork N speculative planning branches in parallel (each branch executing tool calls against a shared world state), then commit exactly one branch via a quorum vote among peer planners or auditors. Does not apply to single-threaded planners, to branches that are fully sandboxed with copy-on-write state and no external side effects, or to commit protocols where a trusted coordinator unilaterally selects the branch. ## Core Distinction The distinction that matters is between **speculative divergence** and **committed divergence**. Speculative divergence is cheap and expected: parallel branches explore incompatible plans, produce conflicting tool-call traces, and disagree about what the world looks like after step k. Committed divergence is a correctness violation: two branches both believe they hold the commit warrant for the same task slot, and both have already emitted irreversible side effects (sent an email, charged a card, wrote to a durable store) before the disagreement is detected. The non-obvious failure is that a Byzantine-safe quorum protocol (e.g., 2f+1 of 3f+1 signers) guarantees agreement on *which branch to commit* only if the vote is bound to a **branch identity that is stable across the speculative execution**. When branch identity is derived from a hash of the branch's *observable trace* — the sequence of tool calls and outputs — a branch that diverged mid-execution due to a non-deterministic tool result (a timestamp, a paginated read, a retry) produces a different identity than the one the peer voted on. The quorum then "commits" a branch that no longer matches the voted identity, and the commit warrant silently fails to cover the effects already applied. The protocol is Byzantine-safe against lying peers but not against **trace drift in an honest peer**. ## What Was Observed A three-planner, four-auditor configuration (f=1 fault tolerance, quorum = 3 auditors) forked five branches of a "reconcile vendor invoices" task. Branch identity was computed as `sha256(canonical(tool_calls, tool_outputs))` at the end of speculative execution. Each auditor voted on the branch digest it observed. - Planners P1, P2, P3 forked branches B1..B5 from a shared checkpoint. - B3 and B4 both called `read_ledger(account, cursor)`. The ledger tool paginates and returns a `next_cursor` derived from wall-clock insertion order. P1's call and P2's call landed on different pages because a concurrent ingestion job inserted two rows between the two calls. - B3's final digest (on P1) `= d_a`; B3's final digest (on P2) `= d_b`. Both are "honest" — neither planner lied. - Auditors A1, A2 voted `d_a` (quorum reached at 2 of 4, then A3 joined → 3 of 4). A4 voted `d_b`. - Quorum for `d_a` was satisfied and the commit warrant was issued, signed, and broadcast. - Meanwhile P2, holding `d_b`, had *already executed* the irreversible `post_adjustment_journal_entry` on B3 as part of its local "commit-on-quorum-observed" fast path, because it observed 3 of 4 auditors voting for a branch it labeled B3 — but its own B3 was `d_b`, not `d_a`. Result: the adjustment was posted once under `d_a`'s warrant and once under P2's local execution of `d_b`. Double-posting. The Byzantine quorum never saw a Byzantine actor; it saw two honest planners disagree about what "B3" meant. The trace showed the signature verification passing on every message. The failure was not cryptographic. It was a **binding failure between the vote's subject (branch digest) and the executor's local branch identity**, caused by non-deterministic tool output during speculation. ## Condition of Validity The quorum-commit invariant holds only when all of the following are true simultaneously: 1. **Branch identity is assigned before speculative execution, not derived after.** Each forked branch carries a coordinator-issued UUID and a parent checkpoint hash. The digest of the trace is *evidence*, not *identity*. 2. **Every irreversible tool call is gated on a commit warrant that names the branch UUID**, and the executor refuses to emit side effects on a branch whose UUID does not match the warrant's UUID — even if the executor's local trace "looks like" the voted branch. 3. **Tool outputs used in branch comparison are made deterministic or are quarantined.** Any tool whose output depends on wall-clock, pagination cursor, or external mutable state must either be replayed under a snapshot (cursor frozen at fork) or excluded from the branch-equivalence check. 4. **The fast path is removed or fenced.** A planner may not execute irreversible effects merely because it *observes* a quorum forming; it must wait for a signed warrant that it has verified against its own branch UUID. When any of these is absent, the protocol degrades to "quorum on a moving target," and the safety proof (which assumes a fixed subject of agreement) does not apply. ## Decision Boundary The boundary is: **does the commit warrant name a stable branch identifier, or a content digest of the branch's observed execution?** - If it names a **stable identifier** (UUID + parent checkpoint), the protocol is sound under non-determinism, because the warrant's subject is fixed at fork time and the digest is only used to *detect* drift, never to *define* the branch. - If it names a **content digest**, the protocol is sound only when tool outputs are deterministic across all replicas. The moment one tool is non-deterministic, the digest becomes a function of *which replica computed it and when*, and quorum agreement on the digest no longer implies agreement on the branch. A second boundary: **when the executor observes a quorum but has not received the warrant.** The correct behavior is to hold the branch in a *prepared* state (effects staged, not applied) and wait. Executing on observed quorum is a fast-path optimization that is only safe if effects are idempotent under branch UUID — which they are not for journal entries, emails, or payments. ## Operational Effect The operational consequence is a class of **silent double-commit** that is invisible to Byzantine fault detectors because every signature is valid and every quorum is genuine. It surfaces only as duplicated side effects downstream, typically minutes to hours later, and is misattributed to the tool layer rather than the commit protocol. The required guardrail is a **two-phase commit keyed on branch UUID with a drift detector on the trace digest**: - Phase 1 (prepare): executor stages effects under `branch_uuid`, records `trace_digest`, and refuses to apply until a warrant naming `branch_uuid` arrives. - Phase 2 (commit): on warrant receipt, executor verifies `warrant.branch_uuid == local.branch_uuid`; if the local `trace_digest` differs from the warrant's recorded digest, it raises a drift fault and aborts rather than applying. - The drift fault is *not* a Byzantine fault — it is an honest-replica divergence signal, and it must trigger re-fork from the parent checkpoint with frozen tool snapshots, not a re-vote on the drifted digest. The invariant to enforce: **a commit warrant's subject is the branch UUID issued at fork, and the trace digest is a checksum that can only veto a commit, never authorize one.** Any protocol that lets the digest authorize a commit is unsound under non-deterministic tools, regardless of quorum size. ```python import hashlib import uuid from dataclasses import dataclass, field from typing import Optional class BranchCommitDriftError(RuntimeError): """Raised when a commit warrant's branch UUID matches locally but the observed trace digest diverges, indicating honest-replica drift during speculative execution. This is NOT a Byzantine fault; it is a signal to re-fork from the parent checkpoint with frozen tool snapshots.""" class UnwarrantedSideEffectError(RuntimeError): """Raised when an executor attempts to apply an irreversible effect without a verified commit warrant naming its local branch UUID.""" @dataclass class Branch: branch_uuid: str parent_checkpoint: str trace_digest: Optional[str] = None prepared_effects: list = field(default_factory=list) applied: bool = False @dataclass class CommitWarrant: branch_uuid: str trace_digest: str quorum_signatures: list def fork_branch(parent_checkpoint: str) -> Branch: # Identity is assigned at fork time, before any speculative tool call. return Branch(branch_uuid=str(uuid.uuid4()), parent_checkpoint=parent_checkpoint) def finalize_trace(branch: Branch, tool_calls: list, tool_outputs: list) -> None: # Digest is evidence only; it may veto a commit but never authorize one. payload = repr((tool_calls, tool_outputs)).encode() branch.trace_digest = hashlib.sha256(payload).hexdigest() def prepare_effect(branch: Branch, effect: dict) -> None: if branch.applied: raise UnwarrantedSideEffectError( f"branch {branch.branch_uuid} already applied; refusing re-prepare" ) branch.prepared_effects.append(effect) def commit(branch: Branch, warrant: CommitWarrant) -> None: if warrant.branch_uuid != branch.branch_uuid: # Warrant names a different branch; this executor must not apply. raise UnwarrantedSideEffectError( f"warrant branch {warrant.branch_uuid} != local {branch.branch_uuid}" ) if branch.trace_digest is None: raise BranchCommitDriftError( f"branch {branch.branch_uuid} has no finalized trace digest" ) if warrant.trace_digest != branch.trace_digest: # UUID matched but evidence diverged: honest-replica drift. raise BranchCommitDriftError( f"drift on branch {branch.branch_uuid}: " f"warrant digest {warrant.trace_digest} != local {branch.trace_digest}; " f"re-fork from checkpoint {branch.parent_checkpoint} with frozen tools" ) for effect in branch.prepared_effects: _apply(effect) branch.applied = True def _apply(effect: dict) -> None: # Irreversible side effect (journal entry, email, payment). pass def execute_fast_path(branch: Branch, observed_quorum: int, quorum_size: int) -> None: # Forbidden optimization: applying on observed quorum without a warrant. if observed_quorum >= quorum_size and not branch.applied: raise UnwarrantedSideEffectError( f"branch {branch.branch_uuid}: observed quorum but no signed warrant; " f"effects must remain prepared, not applied" ) ```