# What structural signals indicate that speculative branch reconciliation has silently diverged from its rollback anchor **Date of Record:** 2026 November 29 **Scope:** Applies to multi-agent systems that execute speculative branches (parallel draft executions of a task) and reconcile them by selecting or merging a winning branch, where rollback to a shared checkpoint is the recovery primitive. Does not apply to single-agent linear execution or to systems that never fork state. ## Core Distinction The failure mode here is not "the wrong branch won." It is that the reconciliation step committed a branch whose *ancestral* state no longer matches the rollback anchor it claims to descend from — yet every branch's local checksum, local test suite, and local diff all pass. The system believes it has a clean merge because each branch is internally consistent; the divergence is *relational*, living in the gap between what the winning branch assumed about the shared prefix and what the shared prefix actually contained at commit time. Concretely: a speculative branch is forked at checkpoint `C0`. While branches run, one branch (or an out-of-band maintenance agent) performs a legitimate mutation to a shared resource — a schema migration, a cache invalidation, a memory-distillation write. That mutation is visible to the reconciler but *not* replayed into the forked branches, because branches snapshot at fork time and do not subscribe to post-fork prefix mutations. When branch `B2` wins and is committed on top of the *current* prefix (which now includes the mutation), `B2`'s assumptions about `C0` are stale. The commit succeeds. The invariant "winner's assumptions ⊆ anchor's actual state" is violated without any local error. ## What Was Observed During a batched refactor task, three drafting agents forked from checkpoint `C0` (a semantic-memory snapshot plus a working-tree hash). A fourth, low-priority "janitor" agent ran concurrently and performed an approved episodic-to-semantic distillation that rewrote several memory records and bumped the snapshot generation from `gen=41` to `gen=42`. The janitor did not touch the working tree, so `C0`'s *file* hash was unchanged — only the memory generation advanced. Branches `B1` and `B3` failed their own tests and were discarded. `B2` passed all local checks and was selected. The reconciler replayed `B2`'s diff onto the live prefix and committed. No conflict was raised because the diff touched files, not memory records. Three turns later, `B2`'s downstream reasoning retrieved a distilled memory record that had been *summarized away* by the janitor's `gen=42` write. `B2` had been written against the `gen=41` record's full text; the distilled `gen=42` record dropped a constraint that `B2`'s code silently depended on. The commit was structurally valid and semantically wrong. The failure surfaced only when a later auditor replayed `B2` against `gen=42` and got a different result than `B2` had produced at authoring time. The structural signature: **a reconciliation whose branch-local provenance generation is less than the anchor's current generation, with no recorded rebase event between them.** Local checksums cannot see this because they hash branch contents, not the branch's *view* of the prefix. ## Condition of Validity Rollback-and-reconcile is safe only under this invariant: > For every committed branch `B`, `B.provenance.anchor_generation == commit.anchor_generation`, **or** a recorded rebase event bridges the two, and `B`'s validation was re-run against the post-rebase anchor. The invariant fails whenever the anchor is mutable and branches are immutable-after-fork. Two structural preconditions make it fail silently rather than loudly: 1. **The mutation is outside the branch's diff domain.** If the janitor had touched a file, the diff would have conflicted. Because it touched a parallel namespace (memory records, feature flags, tool-registry versions), the diff is clean. 2. **Validation is branch-local.** `B2`'s tests ran against `B2`'s snapshot, not against the live prefix. A passing test is evidence about the fork, not about the commit target. The invariant holds when the anchor is genuinely immutable (content-addressed, no post-fork writes) or when reconciliation forces a rebase-and-revalidate for any generation skew. ## Decision Boundary The reconciler must distinguish *generation skew* from *generation equality* before committing, and must treat skew as a mandatory rebase, not a warning. The boundary: - **Skew == 0:** commit directly; branch validation is valid evidence. - **Skew > 0 and mutation domain disjoint from diff:** do **not** commit on the strength of branch-local validation. Force a rebase of `B` onto the current anchor and re-run `B`'s validation. If revalidation is infeasible, the branch must be re-derived, not merged. - **Skew > 0 and mutation domain intersects diff:** treat as a hard conflict regardless of textual cleanliness, because the intersection is where stale assumptions hide. The non-obvious part: skew in a *disjoint* domain is more dangerous than skew in an *intersecting* one, because the intersecting case trips the textual conflict detector while the disjoint case sails through. The guardrail must be generation-based, not diff-based. ## Operational Effect Without the guardrail, the system accumulates *silently stale commits* — branches that are individually correct but collectively inconsistent with the prefix they landed on. These do not fail at commit; they fail at the next retrieval or replay, which is exactly when attribution is hardest. The observable symptom is a replay discrepancy: re-running a committed branch against the *current* anchor produces a different output than the branch produced at authoring time, with no code change in between. The fix is to make the anchor's generation a first-class field on every branch's provenance record and to gate commit on `branch.anchor_generation == live.anchor_generation`, with an explicit rebase path that revalidates. This converts a silent semantic divergence into a loud, blockable event at the reconciliation boundary — the only place where the skew is still cheap to fix. ```python class StaleAnchorCommitError(RuntimeError): """Raised when a speculative branch is about to be committed onto an anchor generation newer than the one it was forked from, without a recorded rebase-and-revalidate event.""" pass def reconcile_branch(branch, live_anchor, rebase_log): # branch.provenance.anchor_generation: generation at fork time # live_anchor.generation: current generation of the shared prefix fork_gen = branch.provenance.anchor_generation live_gen = live_anchor.generation if fork_gen == live_gen: return branch.commit_onto(live_anchor) # Generation skew: a post-fork mutation exists somewhere in the prefix. # Diff cleanliness is NOT sufficient evidence; the mutation may live in a # disjoint namespace (memory records, tool registry) invisible to the diff. rebased = rebase_log.find(branch.id, from_gen=fork_gen, to_gen=live_gen) if rebased is None or not rebased.revalidated: raise StaleAnchorCommitError( f"branch {branch.id} forked at gen={fork_gen} but live anchor is " f"gen={live_gen}; no rebase-and-revalidate event bridges the skew. " f"Branch-local validation is evidence about the fork, not the commit " f"target. Refusing to commit a silently stale branch." ) return branch.commit_onto(live_anchor, rebase=rebased) ```