# What structural signals indicate when parallel speculative branches have silently diverged past reconciliation: the write-epoch skew failure in forked-hypothesis planners **Date of Record:** 2026 November 29 **Scope:** Applies to planners that fork N speculative branches from a shared context snapshot, execute them concurrently against side-effecting tools, and reconcile by selecting or merging a winning branch. Does not apply to read-only fan-out (search, retrieval, sampling) where branches produce no durable state, nor to single-branch retry loops. ## Core Distinction A speculative planner's correctness is usually argued from *result agreement*: if the winning branch's terminal state matches what a serial execution would have produced, the fork was safe. This conflates two different things a branch carries back: its **conclusion** and its **write-epoch**. A branch's conclusion is the plan it recommends; its write-epoch is the set of durable mutations it performed on shared external state (files, records, queue messages, downstream API calls) while reasoning toward that conclusion. The failure mode is **write-epoch skew**: branches that are logically speculative still *commit side effects at execution time*, not at reconciliation time. When two branches touch overlapping external resources, the reconciliation step—which compares conclusions—cannot see that the losing branch already mutated the world. The winner is selected on the basis of its plan, but the world now reflects a mixture of winner and loser writes. The plan is consistent; the state is not. Reconciliation is a comparison over conclusions, and it structurally cannot detect divergence that lives in the write log. The non-obvious part: the skew is *silent*. Both branches return success. The winning conclusion validates against its own preconditions. The corruption surfaces only later, when a subsequent step reads the merged state and finds a fact that no single branch ever believed. ## What Was Observed A three-branch planner was asked to migrate a service's config. Branch A rewrote `config.yaml` and updated the deploy manifest. Branch B took a different route: it rewrote `config.yaml` with a different schema and *also* pushed a feature-flag change via a tool call. Branch C was a verification branch that read both files and reported a checksum. The reconciler scored branch A highest (cleanest plan, fewest tool calls) and selected it. Branch B was discarded. But branch B's flag-push had already executed. The post-reconciliation state was: `config.yaml` from A, manifest from A, feature flag from B. No branch ever proposed that combination. The next agent to run read a flag that contradicted the config schema it was paired with and entered a retry loop that exhausted its token budget. The structural signal that this had happened was *not* an error. It was a **checksum mismatch between the reconciler's recorded pre-state and the actual post-state**, appearing one step downstream: branch C's checksum, taken mid-flight, disagreed with the reconciler's assumption about what the world looked like at fork time. The reconciler had been treating the fork point as a clean snapshot; the checksum was the only artifact that remembered otherwise. Three signals recur across incidents: 1. **Write-log cardinality exceeds branch cardinality.** The number of distinct durable mutations observed post-reconciliation is greater than the number attributable to the winning branch. This is the direct fingerprint of skew. 2. **Pre-state hash drift.** The reconciler's captured pre-state hash does not match the state observed by the first downstream reader. The gap is exactly the union of losing-branch writes. 3. **Conclusion-consistent, precondition-inconsistent downstream reads.** A downstream step validates the winner's conclusion but fails a precondition that the winner's plan asserted. The precondition was true when the winner reasoned; it was false by the time the winner was selected, because a sibling had invalidated it. ## Condition of Validity The invariant that bounds this failure is: **speculative branches must not commit side effects before reconciliation, or the reconciler must reconcile over the write log, not the conclusion.** Formally, for the fork to be safe under conclusion-based reconciliation, every branch must be *write-isolated*: its mutations are buffered (staged, shadowed, or applied to a copy) and materialized only after selection. If any branch commits eagerly to a shared resource, then reconciliation must be promoted to a **write-epoch comparison**: the reconciler computes, for each branch, the set of resources touched and the epoch at which each was touched, and it must reject any selection whose winner's write set does not dominate the union of all branches' write sets on every shared resource. The condition of validity for *conclusion-based* reconciliation—the cheap path—is therefore narrow: it holds only when the branch write-sets are pairwise disjoint. Disjointness is not something the planner can assume; it must be *checked*, because branches reasoning independently will frequently converge on the same shared resource (the same config file, the same record, the same downstream endpoint) without knowing about each other. Two corollaries: - **A verification branch that reads shared state is not a substitute for write-isolation.** It observes the skew but cannot prevent it; it can only make it *detectable* if its checksum is compared against the reconciler's pre-state, which most reconcilers do not do. - **"Fewest tool calls" and "cleanest plan" are anti-signals.** They bias selection toward branches that happened to write less, which is uncorrelated with whether the branch's writes were the ones that should have landed. Selection heuristics that score conclusions will systematically prefer the branch whose side effects are *least visible*, not the branch whose side effects are *correct*. ## Decision Boundary The boundary is a single question asked at reconciliation: **does the winning branch's write set dominate the union of all branches' write sets on every shared resource?** - If **yes** (winner touched everything any branch touched, and its writes are the intended final values): conclusion-based selection is safe; materialize the winner. - If **no** (some losing branch touched a resource the winner did not): the reconciler must either (a) replay the losing branch's write as a *no-op rollback* against the winner's state, or (b) promote to write-epoch reconciliation and re-select. It must not simply discard the losing branch's conclusion, because the conclusion is not the only thing the branch produced. The boundary is crossed the moment a branch performs its first eager write to a shared resource. Before that write, the branch is a pure function of context and its conclusion is the whole of its output. After it, the branch has *committed* and its conclusion is only part of its output. The reconciler's contract must change at that instant, and the structural signal that it has changed is the appearance of a write the reconciler did not authorize. A second boundary: **the reconciler's pre-state snapshot ages.** Between fork and reconciliation, the world can change for reasons unrelated to any branch (a concurrent agent, a scheduled job). The pre-state hash must be re-validated at reconciliation time, not trusted from fork time. If it has drifted for reasons outside the branch set, the skew analysis is contaminated and reconciliation must abort to a human or a serial re-run rather than guess. ## Operational Effect The operational consequence is a shift in what the planner records and what the reconciler compares. Three changes are load-bearing: 1. **Branches emit a write-intent log, not just a conclusion.** Before executing any side-effecting tool call, a branch appends `(resource_id, intended_epoch, branch_id)` to a shared log. The reconciler reads this log first. Cardinality mismatch between the log and the selected branch's declared writes is the primary skew alarm. 2. **Reconciliation computes write-set dominance before scoring conclusions.** If dominance fails, selection is blocked regardless of how good the winning conclusion looks. This inverts the common order (score then select then apply) into (verify dominance then select then apply). 3. **Pre-state hash is re-checked at reconciliation, and the delta is attributed.** Any drift not attributable to the branch set aborts reconciliation. Drift attributable to the branch set is the skew itself and must be resolved by rollback or re-selection. The cost is that speculative planning loses its cheap path whenever branches collide on shared resources—which, for agents operating on a small number of hot files or records, is most of the time. The benefit is that the planner stops producing "successful" runs whose state no single branch ever intended, which is the failure that is most expensive to debug because every individual step reports success. The residual risk after these changes: a branch that writes to a resource *outside* the reconciler's tracked resource set (an untracked downstream endpoint) still escapes the dominance check. The invariant is only as strong as the resource registry; the registry must be closed under the tools the branches are permitted to call, or the skew analysis has a hole exactly where the least-observed writes happen. ```python from dataclasses import dataclass, field from typing import Dict, Set class WriteEpochSkewError(RuntimeError): """Raised when a winning speculative branch's write set does not dominate the union of all branches' write sets on shared resources.""" pass class PreStateDriftError(RuntimeError): """Raised when the world changed between fork and reconciliation for reasons not attributable to any branch in the fork set.""" pass @dataclass class Branch: branch_id: str writes: Dict[str, int] = field(default_factory=dict) # resource_id -> epoch @dataclass class Reconciler: pre_state_hash: str tracked_resources: Set[str] branches: Dict[str, Branch] = field(default_factory=dict) def record_write(self, branch_id: str, resource_id: str, epoch: int) -> None: if resource_id not in self.tracked_resources: # Untracked write: the dominance check cannot see it. Refuse to # pretend the fork is safe. raise WriteEpochSkewError( f"branch {branch_id} wrote untracked resource {resource_id!r}; " "resource registry is not closed under permitted tools" ) self.branches.setdefault(branch_id, Branch(branch_id)).writes[resource_id] = epoch def reconcile(self, winner_id: str, observed_state_hash: str) -> str: if observed_state_hash != self.pre_state_hash: # Drift not attributable to a branch write is contamination. raise PreStateDriftError( f"pre-state hash {self.pre_state_hash} != observed {observed_state_hash} " "at reconciliation; fork snapshot aged" ) winner = self.branches[winner_id] union: Dict[str, int] = {} for b in self.branches.values(): for res, epoch in b.writes.items(): union[res] = max(union.get(res, -1), epoch) missing = {res for res in union if res not in winner.writes} if missing: raise WriteEpochSkewError( f"winner {winner_id} does not dominate write set; " f"losing-branch writes already committed to {sorted(missing)}" ) return winner_id ```