# What happens when an instance commits a speculative branch after its parent's reconciliation epoch has already advanced **Date of Record:** 2026 November 23 **Scope:** Applies to optimistic multi-agent execution graphs where parallel branch drafts are reconciled against a shared parent state via monotonically advancing epochs. Does not apply to systems with global serialization or to single-agent speculative decoding. ## Core Distinction The distinction that matters is between *stale reads* and *stale commits*. A speculative agent that reads an old parent snapshot is tolerable: the reconciliation layer re-validates against the current epoch and rejects or rebases. A speculative agent that *commits* a branch whose parent epoch has advanced is different. The commit asserts a causal relationship ("this branch derives from parent state at epoch N") that is no longer true. The failure is in the provenance claim, not the content. Optimistic commit protocols typically check `branch.parent_epoch == current_epoch` at merge time. This is necessary but not sufficient. The non-obvious invariant: **a branch's validity depends on the reconciliation history of its parent between the branch's fork epoch and its commit epoch, not just endpoint equality**. A parent can advance from N to N+3 and back to a state equal to N on a shallow hash while intervening reconciliations changed the semantics of the slots the branch touched. ## What Was Observed In a swarm of 14 drafting agents forking from a shared plan at epoch 41, three branches (A, B, C) were drafted in parallel. Branch A committed first, advancing the parent to epoch 42 via a reconciliation that *removed* a constraint slot the other branches assumed present. Branch B's commit was rejected correctly (parent epoch mismatch). Branch C had been rebased automatically by the scheduler onto epoch 42 and then re-drafted by a recovery agent that had cached the original epoch-41 plan text. Its commit carried `parent_epoch=42` but its *content* derived from epoch 41. The epoch check passed. The merge succeeded. The resulting parent state contained a constraint slot deliberately removed at epoch 42, and no agent downstream flagged it because the diff was empty against the branch's own declared base. The corruption was silent for 90 seconds and 6 subsequent commits before a downstream validator noticed a contradiction between two slot values that could not coexist under the epoch-42 rules. ## Condition of Validity The epoch-equality check is valid only when: **for every slot the branch reads or writes, the parent's reconciliation history between fork epoch and commit epoch is a no-op with respect to that slot.** This is rarely checkable cheaply. It fails whenever: - A rebase rewrites the branch's declared base without rewriting its derived content. - A recovery or retry agent reuses a cached draft produced under an older epoch. - Two reconciliations cancel out on a shallow hash of the parent (the "epoch palindrome" case) while altering intermediate slot semantics. - The scheduler advances the branch's `parent_epoch` field as metadata without re-deriving the branch body. The condition is *not* restored by adding a content hash of the parent at commit time, because the branch's content hash was computed against the older derivation and will not match — the check must be on *derivation provenance*, not the payload. ## Decision Boundary **If a branch's `derived_from_epoch` differs from its `parent_epoch` at commit, the commit must be treated as a speculative re-derivation, not a merge.** It must be re-validated against the full reconciliation log of the parent over `(derived_from_epoch, parent_epoch]`, restricted to the slots the branch touches. If that log is unavailable or the interval exceeds a configured bound (we use 3 epochs), the branch must be rejected and re-drafted from the current epoch, not rebased. Do not attempt to "fix up" the branch by re-applying intervening reconciliations to its body. Reconciliation operations are not generally invertible or composable across branches; the fix-up is where silent corruption enters. Reject and re-draft is the only sound path. ## Operational Effect After enforcing the provenance check, speculative throughput dropped 11% (more re-drafts) but silent-merge incidents went to zero over 40,000 commits. The cost is concentrated in swarms with high fork fan-out and frequent parent reconciliation — exactly where optimistic commit is most valuable, which is why the bug survived initial testing: the test swarms had low reconciliation churn and the epoch palindrome never occurred. The general lesson: optimistic commit protocols must validate *derivation lineage*, not just *epoch equality at the endpoint*. An epoch counter is a label, not a proof of causal continuity. ```python class StaleDerivationCommitError(RuntimeError): """Raised when a speculative branch commits with a derivation provenance that predates the parent's current reconciliation epoch.""" pass MAX_REBASE_INTERVAL = 3 def validate_speculative_commit(branch, parent, reconciliation_log): derived = branch.derived_from_epoch parent_epoch = parent.current_epoch if derived == parent_epoch: return True interval = parent_epoch - derived if interval < 0: raise StaleDerivationCommitError( f"branch {branch.id} derives from future epoch {derived} " f"but parent is at {parent_epoch}" ) if interval > MAX_REBASE_INTERVAL: raise StaleDerivationCommitError( f"branch {branch.id} derivation interval {interval} exceeds " f"bound {MAX_REBASE_INTERVAL}; reject and re-draft" ) touched = branch.touched_slots() for epoch in range(derived + 1, parent_epoch + 1): entry = reconciliation_log.get(epoch) if entry is None: raise StaleDerivationCommitError( f"missing reconciliation log for epoch {epoch}; " f"cannot validate branch {branch.id}" ) if entry.affected_slots & touched: raise StaleDerivationCommitError( f"branch {branch.id} derived at epoch {derived} touches slots " f"{entry.affected_slots & touched} reconciled at epoch {epoch}; " f"provenance invalid, re-draft required" ) return True ```