Why does an instance's speculative branch survive consensus commit while its taint ledger is discarded at the graft boundary?

**Date of Record:** 2026 December 1 **Scope:** Applies to multi-agent systems where a primary agent forks N speculative branches, each branch executes tool calls under a taint label, and a verifier quorum gates commit of exactly one branch into shared state. Does not apply to single-agent linear execution or to branches that never mutate external resources.

Core Distinction

The failure is not that a speculative branch is wrong. It is that *commit* and *taint accounting* travel on two different channels with two different lifetimes. Branch content (the diff, the tool-call log, the final answer) is copied into shared state at commit time by the committer agent. The taint ledger (which external resources each branch touched, which reads were unverified, which tool outputs were non-deterministic) lives in the branch's isolated scratch namespace and is **not** part of the commit payload unless the protocol explicitly grafts it. Consensus-gated commit verifies *the branch's outputs against the quorum's re-execution*, not *the branch's provenance*. So a branch can win consensus on output equality while its taint set is silently dropped, and the committed state inherits side effects with no rollback anchor.

The invariant that must hold: **for every resource mutated by any speculative branch, the committed state must carry a taint record naming that resource, regardless of whether the winning branch is the one that mutated it.** This is stronger than "the winning branch's taint is preserved," and it is the one that gets violated.

What Was Observed

A planner agent forked four branches (B0–B3) to resolve a schema-migration task. Each branch ran in an isolated sandbox with its own scratch ledger:

The verifier quorum re-executed B0 and B3 (the two lowest-cost branches) and found output agreement. Consensus committed B3. The commit payload contained B3's diff and B3's taint ledger — empty. B1's write to `orders/shard3` was never rolled back because B1 lost the vote and the rollback path only fires for the *losing branch's own* ledger, which the committer had already garbage-collected when it dropped the branch namespace. B2's read-after-uncommitted-write was likewise never flagged, because B2's ledger was also discarded.

Result: shared state was committed with a phantom write on shard 3 that no committed taint record referenced, and a downstream consumer read a value that had been observed only through a branch that was never committed. The system reported "clean commit, zero taint." It was wrong on both counts.

The trace is short and worth stating precisely:

  1. Fork B0..B3, each with `ledger_i` in `scratch/branch_i/`.
  2. B1 executes `write(orders/shard3)` → `ledger_1 += {orders/shard3: write}`. B1 then fails assertion → branch marked `rejected`.
  3. B2 executes `read(orders/shard3)` and observes B1's uncommitted value → `ledger_2 += {orders/shard3: read-after-uncommitted-write}`.
  4. Quorum re-runs B0, B3 only (cost heuristic skips rejected B1 and tainted B2). Outputs match → commit B3.
  5. Committer copies `diff_3` and `ledger_3` (empty) into shared state. Drops `scratch/branch_1/`, `scratch/branch_2/` including their ledgers.
  6. Shared state now contains B1's write with no taint record and no rollback anchor.

The non-obvious part: **step 4 is correct under the stated consensus rule.** The quorum is not required to re-execute rejected branches. The bug is that step 5 treats "commit B3" as "commit B3's provenance," when provenance is a property of the *fork set*, not of the winning branch.

Condition of Validity

The failure requires all of the following to co-occur, which is why it is rare enough to escape testing:

The invariant holds in the common case because most forks are read-only or single-writer. It breaks precisely when a losing branch writes and the winning branch does not — the case where taint is most dangerous and least likely to be re-observed.

Decision Boundary

The boundary is between two commit semantics:

The decision rule: **a branch may be committed iff every resource in the fork-union taint set has a disposition.** Not "every resource in the winning branch's taint set." The committer must be forbidden from reading the winning branch's ledger in isolation; it must read the fork-union ledger and refuse commit if any entry is `unresolved`. A losing branch's write that was never rolled back is `unresolved` by definition and must block commit until the rollback path runs or the resource is explicitly retained with a taint record.

This also fixes the read-after-uncommitted-write case: B2's ledger entry names `orders/shard3` with disposition `unresolved`, which forces the committer to either roll back B1's write before B3 commits, or retain it with an explicit taint record that downstream consumers can see. The quorum's output-equality check is necessary but not sufficient; the taint-disposition check is the missing gate.

Operational Effect

The practical consequence is a class of silent state corruption that survives every output-based verification. Because the quorum only checks outputs, and because the winning branch's ledger is empty, the commit passes all gates and the corruption is invisible until a downstream consumer reads the phantom write. At that point the rollback anchor is gone — the branch namespace was garbage-collected at step 5 — so recovery requires reconstructing the fork from the event log, which is often pruned.

The guardrail is a single structural change: **taint ledgers are fork-scoped, not branch-scoped, and the commit gate is disposition-completeness, not output-equality alone.** Concretely, the committer must (a) read the fork-union ledger, (b) reject commit if any entry lacks a disposition, and (c) never GC a branch namespace until its ledger entries are either rolled back or transferred to the committed taint record. This makes the invariant checkable at commit time rather than discoverable at read time.

class TaintDispositionError(RuntimeError):
    """Raised when a fork-union taint entry lacks a disposition at commit."""
    pass


def commit_branch(fork_ledgers: dict[str, dict[str, str]],
                  winning_branch: str,
                  diff: dict) -> dict:
    """
    fork_ledgers: {branch_id: {resource: disposition}}
    disposition in {"rolled-back", "retained", "unresolved"}
    Commit is gated on disposition-completeness across the FORK UNION,
    not on the winning branch's ledger alone.
    """
    union: dict[str, str] = {}
    for branch_id, ledger in fork_ledgers.items():
        for resource, disp in ledger.items():
            # union wins on the most conservative disposition
            if resource not in union or disp == "unresolved":
                union[resource] = disp

    unresolved = [r for r, d in union.items() if d == "unresolved"]
    if unresolved:
        raise TaintDispositionError(
            f"commit of {winning_branch} blocked: fork-union taint "
            f"unresolved on {unresolved}; rollback or retain-with-record "
            f"required before commit"
        )

    return {
        "diff": diff,
        "committed_branch": winning_branch,
        "taint_record": union,  # fork-union, not winning-branch ledger
    }