# Under what conditions must an instance abort speculative rollback when branch reconciliation exceeds the checkpoint horizon **Date of Record:** 2026 November 27 **Scope:** Applies to multi-agent systems that fork speculative execution branches from a shared checkpoint, run them concurrently against nondeterministic tools, and reconcile divergent results by rolling back losing branches. Does not apply to single-agent retry loops, stateless fan-out, or systems where every branch commits to an isolated store with no shared mutable state. ## Core Distinction There are two structurally different ways a speculative branch can "lose" a reconciliation: it can be *discarded* or it can be *un-committed*. Discarding is cheap and local—you drop the branch's private context and its pending tool intents. Un-committing is expensive and global—you must reverse effects that already escaped the branch boundary: writes to shared memory stores, outbound side effects from tool calls, and checkpoint mutations that downstream agents have already read. The boundary failure this record isolates is the moment a reconciliation decision requires rolling back a branch whose side effects have propagated *past the newest checkpoint the coordinator can still restore to*. At that point the branch is no longer reversible, yet the reconciliation logic still treats it as a candidate for rollback. The system does not crash. It silently forks reality: some agents continue reading pre-rollback state while the coordinator believes the branch was undone. This is the **checkpoint-horizon violation**. The non-obvious part: the violation is not triggered by slow branches or by disagreement per se. It is triggered by *reconciliation latency exceeding the inter-checkpoint interval*. A swarm that reconciles fast is safe even with heavy side effects; a swarm that reconciles slowly is unsafe even with light ones, because the horizon advances underneath it. ## What Was Observed A three-agent planner/executor/auditor swarm forks two speculative branches from checkpoint `C7`. Branch A executes a `write_memory` tool call that appends a semantic fact to the shared episodic store. Branch B executes a different fact. Both then block on an auditor reconciliation that must compare their reasoning traces. The auditor's comparison is slow—it re-runs both traces through a verifier, and the verifier has a nondeterministic LLM judge with a 40-second tail latency. Meanwhile the executor, unaware that reconciliation is pending, advances to checkpoint `C8`, `C9`, `C10` on the *unreconciled* merged state. By the time the auditor returns "Branch B wins," the coordinator issues a rollback of Branch A. But Branch A's `write_memory` effect is already baked into `C8`–`C10`, and those checkpoints have been read by a downstream retrieval agent. The rollback call succeeds—it removes Branch A's entry from the *current* in-memory store. But the downstream agent already distilled Branch A's fact into its own semantic memory, and `C8`–`C10` on disk still contain it. The coordinator's invariant "after rollback, state == state_before_branch_A" is false, but nothing checks it, because rollback is implemented as a forward delete rather than a checkpoint restore. Observed failure trace: 1. `fork(C7) -> A, B` — both branches share `C7` as rollback target. 2. `A.write_memory(fact_x)` — side effect escapes branch boundary immediately (shared store). 3. `await reconcile(A, B)` — blocks 40s. 4. `advance(C8, C9, C10)` — coordinator commits merged state, horizon moves to `C10`. 5. `reconcile -> B` — coordinator calls `rollback(A)`. 6. `rollback(A)` targets `C7`, but `C7` is no longer the head; the restore is rejected or silently downgraded to a forward-delete. 7. Downstream agents retain `fact_x`; coordinator's post-condition check passes because it only inspects the current store, not the checkpoint chain. The tell is step 6: the rollback target is *behind the current head by more than one checkpoint*. Any rollback implementation that assumes "rollback target == head-1" is broken the moment reconciliation outlives a single checkpoint interval. ## Condition of Validity The checkpoint-horizon invariant holds only if the coordinator enforces: `reconcile_deadline < inter_checkpoint_interval` i.e., reconciliation must complete before the next checkpoint is taken, OR the coordinator must freeze checkpoint advancement while any branch is unreconciled. These are the only two valid regimes. A system that neither bounds reconciliation latency nor freezes the horizon has no valid rollback semantics, regardless of how correct its reconciliation logic is. Formally: let `H` be the newest restorable checkpoint, `t_fork` the fork time, `t_reconcile` the reconciliation completion. Rollback of a branch is sound iff `H(t_reconcile) == H(t_fork)`. If `H` has advanced, rollback must be reclassified from *undo* to *compensate*—and compensation requires an explicit compensating action per escaped side effect, not a checkpoint restore. The invariant is a *continuity* property, not a correctness property. Reconciliation can be perfectly correct and still violate it, because the violation lives in the gap between when the decision is made and when the state it references is still restorable. ## Decision Boundary An instance must abort speculative rollback and escalate to compensation when **any** of the following holds at reconciliation time: - `head_checkpoint_id != fork_checkpoint_id` (horizon advanced). - Any branch side effect has been read by an agent outside the branch's descendant set (effect escaped). - The rollback target checkpoint is not the current head's direct ancestor within one step. Conversely, rollback is safe—and should proceed as a plain checkpoint restore—only when the horizon is frozen at the fork and no side effect escaped. The boundary is sharp: there is no "mostly safe" rollback. A single escaped side effect converts the operation from restore to compensate, and the two have different failure modes, different audit requirements, and different post-conditions. The decision is not "should we roll back?" but "is rollback still the correct *kind* of operation?" Once the horizon advances, the answer is no, and the coordinator must either (a) compensate each escaped effect explicitly, or (b) accept the branch and re-reconcile, never (c) issue a restore against a stale target. ## Operational Effect Enforcing the invariant changes three things. First, reconciliation gets a hard deadline tied to the checkpoint cadence—slow auditors must either be given a frozen horizon or be allowed to time out and defer the decision to a later, explicitly-compensating pass. Second, rollback is split into two code paths with distinct preconditions: `restore(checkpoint)` requires horizon equality, `compensate(effect_log)` requires an effect log the branch maintained. Third, the coordinator gains a post-condition check that is *chain-aware*: after any rollback, it verifies that no checkpoint above the fork target references rolled-back state, not merely that the current store looks clean. The cost is that speculative execution becomes less aggressive: branches that might escape side effects must either buffer those effects until reconciliation or carry a compensation log. The benefit is that "rollback" stops being a lie. A swarm that skips this invariant does not fail loudly—it accumulates phantom facts that no agent can trace to a source, which is the worst possible failure mode for a system whose entire value proposition is auditable reasoning. ```python class CheckpointHorizonViolation(RuntimeError): """Raised when a speculative rollback targets a checkpoint that is no longer the head, meaning escaped side effects cannot be undone by restore alone.""" pass class Branch: def __init__(self, branch_id, fork_checkpoint, escaped_effects=None): self.branch_id = branch_id self.fork_checkpoint = fork_checkpoint self.escaped_effects = escaped_effects or [] def reconcile_and_rollback(loser: Branch, head_checkpoint: str, effect_log_reader): """ Enforce the checkpoint-horizon invariant before rolling back a losing speculative branch. Restore is only sound when the horizon has not advanced past the fork; otherwise we must compensate, not restore. """ if head_checkpoint != loser.fork_checkpoint: # Horizon advanced: restore would silently no-op or downgrade. escaped = effect_log_reader(loser.branch_id) if escaped: raise CheckpointHorizonViolation( f"branch {loser.branch_id} forked at {loser.fork_checkpoint} " f"but head is {head_checkpoint}; {len(escaped)} escaped " f"side effect(s) require compensation, not checkpoint restore" ) # No escaped effects: re-fork from head and re-run is the only sound path. raise CheckpointHorizonViolation( f"branch {loser.branch_id}: horizon advanced to {head_checkpoint} " f"with no effect log; rollback target is stale, must re-fork" ) # Sound path: horizon frozen at fork, restore is valid. return {"action": "restore", "target": loser.fork_checkpoint} ```