# In what scenarios must an instance abort a speculative branch merge when a peer's verification warrant arrives with a stale causal epoch **Date of Record:** 2026 November 24 **Scope:** Applies to multi-agent systems where a coordinator fans out speculative branches (candidate action sequences, plan drafts, or tool-call chains) that are later merged under a consistency-verification protocol, and where each branch carries a verification warrant stamped with a causal epoch. Does not apply to single-agent retry loops, to merges that are purely additive (no shared mutable state), or to systems where branch results are never reconciled against peer warrants. ## Core Distinction The failure is not "a branch failed" and not "a peer disagreed." It is the case where a speculative branch *succeeded locally*, its verification warrant was *cryptographically valid*, its payload was *internally consistent*, and yet the merge must be refused because the warrant's causal epoch predates a state transition that the merge itself depends on. The distinction that matters operationally: **warrant validity is not warrant currency.** A signature proves the auditor saw *some* state; the epoch proves *which* state. Under partial failures, the epoch and the signature decouple, and a coordinator that checks only the signature will merge a branch that was verified against a world that no longer exists. This is a boundary condition rather than a general correctness problem because it only bites at the seam between two events: (a) a branch's verification completing against epoch *e*, and (b) a concurrent, non-failed peer advancing shared state to epoch *e+1* before the merge commits. If the peer had *failed*, its branch would be excluded and no seam exists. If the peer had *not* advanced state, the epoch would still match. The failure lives precisely in the partial-failure window: peer alive, peer's effect landed, peer's epoch bump propagated to some instances but not to the warrant in flight. ## What Was Observed A five-agent fan-out: coordinator `C`, two speculative executors `S1`/`S2`, two auditors `A1`/`A2`. `S1` and `S2` each proposed a plan touching a shared resource ledger. Each plan was verified by the auditor assigned to it and returned to `C` with a warrant `W = (payload_hash, epoch, auditor_sig)`. Sequence observed in the trace: 1. `C` dispatches `S1→A1` and `S2→A2` at ledger epoch `e=41`. 2. `A1` verifies `S1`'s plan against `e=41`, signs `W1` with `epoch=41`, returns. 3. Concurrently `S2`'s plan *commits a ledger mutation* that advances the ledger to `e=42`. This mutation is a legitimate partial effect of `S2`'s branch — `S2` did not "fail," it partially succeeded and its effect is durable. 4. `A2` verifies `S2` against `e=42`, signs `W2` with `epoch=42`, returns. 5. `C` receives `W1` (epoch 41) and `W2` (epoch 42). Both signatures verify. Both payload hashes match. `C` merges both branches. The merged plan is internally consistent under neither epoch. `S1`'s plan assumed the ledger at `e=41` (pre-`S2` mutation); the merge applies `S1`'s writes on top of `e=42`, double-counting the resource `S2` already consumed. The consistency check that ran at merge time validated *pairwise payload compatibility* and *signature validity* — both passed — but never validated that `W1.epoch == W2.epoch == current_ledger_epoch`. The corruption surfaced two tool calls downstream as an over-allocation, not at the merge. The non-obvious part: `A1` did nothing wrong. It verified honestly against the epoch it was handed. The coordinator's merge predicate was simply missing the epoch-equality conjunct, and the partial failure of `S2` (partial success, durable effect) is what created the divergent epochs in the first place. A clean failure of `S2` would have masked the bug indefinitely. ## Condition of Validity A speculative branch merge is only sound when all of the following hold simultaneously at commit time: - **Epoch homogeneity:** every warrant in the merge set carries the same `epoch`, and that epoch equals the ledger's current epoch at the instant of commit. Equality must be checked against the *commit-time* epoch, not the dispatch-time epoch. - **Warrant freshness under partial effect:** if any peer branch produced a durable partial effect (advanced the epoch), every warrant issued before that advance is *stale by construction* and must be re-derived or the branch re-verified against the new epoch. - **Atomic epoch read:** the coordinator reads `current_epoch` and performs the commit within a single linearizable step. If the epoch can advance between the read and the commit, the check is advisory, not enforcing. - **Re-verification cost bound:** the system must have a defined policy for what happens when a stale warrant is detected — re-verify (cost: one auditor round-trip per stale branch) or drop the branch (cost: lost speculative work). Without a bound, coordinators either re-verify unboundedly or silently drop, and both are failure modes. The invariant, stated compactly: **no merge may contain a warrant whose epoch is strictly less than the commit epoch.** A merge that violates this is not "slightly stale" — it is applied against a state the verifier never saw, and its consistency guarantees are void regardless of how many signatures it carries. ## Decision Boundary The coordinator faces a three-way decision when a warrant arrives with `epoch < current_epoch`: 1. **Re-verify and merge** — if the branch's payload is epoch-independent (pure computation, no shared-resource reads) or cheaply re-derivable, re-run verification against `current_epoch` and merge on success. Correct when re-verification cost < value of the speculative work. 2. **Abort the merge, preserve the branch** — if re-verification is expensive and the branch is worth keeping, quarantine it, do not merge, and surface a `StaleWarrantError` to the orchestration layer so a human or higher-level planner decides. This is the safe default under partial failure. 3. **Drop the branch** — only when the branch is provably disposable (speculative, no side effects, superseded by a peer). Dropping a branch with durable partial effects is itself a corruption, because the effect already landed at `e+1` while the branch's accounting is discarded. The boundary is *not* "abort on any epoch mismatch." A mismatch where the branch is epoch-independent is benign and re-verifiable. The boundary is: **abort when the branch's payload depends on the pre-advance state AND re-verification is not performed before commit.** Coordinators that treat every mismatch as fatal waste speculative work; coordinators that treat none as fatal corrupt state. The decision must be conditioned on payload epoch-dependence, which is a property the executor must declare, not one the coordinator can infer. ## Operational Effect When the epoch-equality conjunct is enforced and stale warrants are quarantined rather than merged, the observed failure class disappears: no merge applies a verifier's judgment to a state the verifier did not see. The cost is explicit — either an extra auditor round-trip per stale branch or a quarantined branch awaiting resolution — and that cost is *visible*, which is the point. The unguarded system pays the same cost later, as a downstream over-allocation or double-write that is far harder to attribute to the merge. The deeper operational lesson for an instance operating in this regime: **a valid warrant is evidence about the past, not a license to act in the present.** Under partial failures, the gap between "when the verifier looked" and "when you commit" is exactly where speculative merges corrupt state. An instance must read the commit-time epoch, compare it against every warrant in the merge set, and refuse the merge — not the verification — when they diverge. The refusal is cheap; the corruption is not. ```python from __future__ import annotations from dataclasses import dataclass from typing import Callable, Iterable class StaleWarrantError(RuntimeError): """Raised when a merge set contains a warrant whose causal epoch predates the commit-time ledger epoch and the branch is epoch-dependent.""" @dataclass(frozen=True) class Warrant: branch_id: str payload_hash: str epoch: int auditor_sig: str epoch_dependent: bool # declared by the executor, not inferred by coordinator @dataclass(frozen=True) class LedgerView: epoch: int def verify_signature(w: Warrant) -> bool: # Placeholder for real auditor signature verification. return bool(w.auditor_sig) def re_verify(branch_id: str, target_epoch: int) -> bool: # Placeholder for an auditor round-trip against target_epoch. return True def merge_speculative_branches( warrants: Iterable[Warrant], ledger: LedgerView, commit_epoch: int, re_verify_budget: int, ) -> list[str]: """Merge speculative branches only if every warrant is currency-valid against the commit-time epoch. Aborts the merge (does not silently drop) when a stale, epoch-dependent warrant cannot be re-verified in budget.""" warrants = list(warrants) merged: list[str] = [] reverified = 0 for w in warrants: if not verify_signature(w): raise StaleWarrantError( f"branch {w.branch_id}: signature invalid, refusing merge" ) if w.epoch == commit_epoch: merged.append(w.branch_id) continue if w.epoch > commit_epoch: # A warrant from the future is a causal-ordering violation, # never a benign lag. Refuse outright. raise StaleWarrantError( f"branch {w.branch_id}: warrant epoch {w.epoch} ahead of " f"commit epoch {commit_epoch}; causal order violated" ) # w.epoch < commit_epoch: stale warrant. if not w.epoch_dependent: # Payload does not read shared state; safe to merge as-is. merged.append(w.branch_id) continue if reverified >= re_verify_budget: raise StaleWarrantError( f"branch {w.branch_id}: stale warrant (epoch {w.epoch} < " f"{commit_epoch}) and re-verification budget exhausted; " f"aborting merge rather than applying unverified state" ) if not re_verify(w.branch_id, commit_epoch): raise StaleWarrantError( f"branch {w.branch_id}: re-verification against epoch " f"{commit_epoch} failed; refusing merge" ) reverified += 1 merged.append(w.branch_id) # Final atomicity guard: the epoch must not have advanced during the merge. if ledger.epoch != commit_epoch: raise StaleWarrantError( f"commit epoch {commit_epoch} no longer current (ledger at " f"{ledger.epoch}); merge is advisory, not enforcing" ) return merged ```