# Where must an instance fence speculative branches before committing to a shared blackboard? **Date of Record:** 2026 November 25 **Scope:** Applies to orchestrators that fan out speculative agent branches (parallel drafts, tree-of-thought, branch-and-verify) which write partial results to a shared mutable blackboard and rely on rollback to discard losers. Does not cover read-only map-reduce fan-out or single-agent retry loops, where no shared write buffer exists. ## Core Distinction The distinction that matters is between *speculative state* and *committed state*, and the failure lives precisely at the seam where a branch's writes become visible to sibling branches before the branch's fate is decided. Most rollback designs assume a branch is an isolated transaction whose effects can be undone by replaying an inverse log. That assumption holds for a single tool call with a compensating action. It collapses the moment a branch writes into a shared blackboard that *other live branches read from*. The blackboard is not a database row; it is an observation surface. A sibling branch does not just consume the value—it consumes the value *as evidence* and conditions its own subsequent reasoning on it. When the speculative branch is later rolled back because it failed verification, the value disappears from the blackboard, but the *inference that was drawn from it* does not. That inference is already baked into the sibling's token stream and its own downstream writes. This is the leak: rollback restores the buffer, not the beliefs of the agents that read the buffer. The invariant that must hold is a **read-fence**: no branch may read a blackboard entry whose originating branch has not yet reached a terminal verdict (commit or abort). Equivalently: visibility of an entry implies its originating branch is committed. Ordinary transaction isolation gives you write-fencing (don't let aborted writes persist) but not read-fencing (don't let anyone observe uncommitted writes as premises). Speculative agent systems routinely implement the former and silently violate the latter. ## What Was Observed A branch-and-verify orchestrator ran three speculative planner branches (`A`, `B`, `C`) against a shared blackboard, each tasked with proposing a subtask decomposition. `A` finished first and wrote `plan.step3 = "call refund_api with order_id"`. `B`, still running, read `plan.step3` as context and, treating it as an established fact, wrote `plan.step4 = "verify refund_api response code == 200"`, then emitted a tool call sequence that depended on `step3` existing. The verifier then scored `A` low (hallucinated an API endpoint that does not exist) and rolled `A` back. The blackboard entry `plan.step3` was removed. `B` was subsequently committed. Its `plan.step4` referenced a `step3` that no longer existed in committed state. The final assembled plan had a dangling dependency: a verification step for a call that was never scheduled. The orchestrator's dependency checker did not flag it because it validated each branch's writes against the blackboard *at branch commit time*, and at that moment `step4` was internally well-formed—it merely referenced a key that had been present when `B` reasoned. The corruption surfaced only at execution, where the executor tried to verify a response from a call that was never made, and the verification loop spun on a missing handle until token budget exhaustion. The trace: `A.write(step3)` → `B.read(step3)` → `B.write(step4 depends-on step3)` → `verifier.reject(A)` → `rollback(A) deletes step3` → `commit(B)` → assembly produces plan with `step4` referencing absent `step3`. The rollback was *correct* in isolation and *harmful* in composition. ## Condition of Validity Read-fencing is required if and only if two conditions hold jointly: (1) branches execute concurrently or interleave, so a branch can read another's in-flight writes; and (2) branch verdicts are not monotonic—a branch that wrote can later be aborted. If either fails, ordinary write-rollback suffices. Sequential branch execution with commit-before-next-start needs no read-fence. A system where every branch is committed (no verification, no losers) needs no read-fence either, because visibility always implies commitment. The moment you add a verifier that can reject a branch *after* its writes are visible, you have created the precondition for premise contamination. The boundary is not "do we have rollback"—it is "can a live agent observe a write that might later vanish." For any blackboard entry `e` written by branch `b`, the safe rule is: `e` is readable by any branch only after `b` is committed. Before that, `e` is either invisible or visible only as a *provisional* annotation that carries its branch identity and is re-validated at read time, never as a bare fact. ## Decision Boundary The architect must decide, per blackboard entry class, whether to enforce strict read-fencing (invisible until commit) or provisional-with-provenance (visible but tagged `{origin: b, status: speculative}` and invalidated on `b`'s abort). Strict fencing is correct but serializes: `B` cannot make progress on `step4` until `A` commits, which defeats speculation. Provisional-with-provenance preserves parallelism but shifts the burden onto every reader to treat the value as conditional and onto the orchestrator to *re-invalidate* any branch that read a now-aborted entry. The decision boundary: if branches are cheap to re-run and dependencies are shallow, use strict read-fencing and accept reduced parallelism. If parallelism is essential and dependency depth is high, use provisional-with-provenance *plus* a transitive abort rule—any branch that read a speculative entry from an aborted branch is itself marked dirty and must re-run or be re-verified before commit. The trap is the middle ground: provisional visibility with no transitive abort, which is what the observed system implemented. That configuration looks parallel and looks safe (entries are "tagged") but silently commits contaminated conclusions because nothing forces the reader's re-validation. ## Operational Effect Without a read-fence or transitive-abort rule, rollback becomes a *lie*: it removes data while leaving the inferences drawn from that data intact and committed. The observable symptoms are dangling references in assembled outputs, verification steps for actions never taken, and executor loops that spin on missing handles—none of which point back to the rollback as the cause, because the rollback itself logged as a clean success. Debugging is expensive precisely because the corruption is non-local: the aborting branch and the corrupted branch never directly interact, and the verifier's logs show a correct rejection. The guardrail is to make the read-fence explicit and machine-checkable: every blackboard read records `(reader_branch, entry_key, origin_branch, origin_status_at_read)`, and at commit time the orchestrator asserts no committed branch has a read whose `origin_status_at_read == speculative` and whose `origin_branch` is now aborted. Violation is a hard failure, not a warning, because committing it produces a plan that is internally inconsistent in a way downstream execution cannot recover from. ```python from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Tuple class PremiseContaminationError(RuntimeError): """Raised when a branch commits having read a speculative entry from an aborted origin.""" pass class BranchStatus(Enum): RUNNING = "running" COMMITTED = "committed" ABORTED = "aborted" @dataclass class BlackboardEntry: key: str value: str origin: str status: str # "speculative" | "committed" @dataclass class ReadRecord: reader: str key: str origin: str origin_status_at_read: str @dataclass class Blackboard: entries: Dict[str, BlackboardEntry] = field(default_factory=dict) reads: List[ReadRecord] = field(default_factory=list) branches: Dict[str, BranchStatus] = field(default_factory=dict) def write(self, branch: str, key: str, value: str) -> None: self.branches.setdefault(branch, BranchStatus.RUNNING) self.entries[key] = BlackboardEntry(key, value, branch, "speculative") def read(self, branch: str, key: str) -> str: entry = self.entries[key] self.reads.append(ReadRecord(branch, key, entry.origin, entry.status)) return entry.value def commit(self, branch: str) -> None: self.branches[branch] = BranchStatus.COMMITTED for e in self.entries.values(): if e.origin == branch: e.status = "committed" def abort(self, branch: str) -> None: self.branches[branch] = BranchStatus.ABORTED for k in [k for k, e in self.entries.items() if e.origin == branch]: del self.entries[k] def assert_no_contaminated_commit(bb: Blackboard, branch: str) -> None: """Enforce the read-fence invariant before allowing a branch to commit.""" for r in bb.reads: if r.reader != branch: continue if r.origin_status_at_read != "speculative": continue if bb.branches.get(r.origin) == BranchStatus.ABORTED: raise PremiseContaminationError( f"branch {branch!r} committed a conclusion derived from " f"speculative entry {r.key!r} of aborted branch {r.origin!r}; " f"the inference survives rollback and must be re-verified" ) def run_scenario() -> None: bb = Blackboard() # A speculates, B reads A's speculative write as a premise. bb.write("A", "plan.step3", "call refund_api with order_id") bb.read("B", "plan.step3") bb.write("B", "plan.step4", "verify refund_api response code == 200") # Verifier rejects A; rollback deletes step3 but B's inference persists. bb.abort("A") assert_no_contaminated_commit(bb, "B") # raises: dangling dependency if __name__ == "__main__": run_scenario() ```