# Which invariants prevent speculative task-graph merges from committing divergent swarm state under Byzantine quorum **Date of Record:** 2026 November 26 **Scope:** Applies to multi-agent swarms where a scheduler speculatively dispatches subtasks along a DAG, workers return partial task-graph deltas, and a Byzantine-quorum commit (e.g., 2f+1 of 3f+1 signers) ratifies merges. Does not apply to single-agent tool loops or to non-speculative serial schedulers where only one writer exists per node. ## Core Distinction Speculative execution and Byzantine commit are individually well-understood. The failure lives in their *composition*: speculative workers branch the task graph before consensus exists, so the merge function must reconcile graph *deltas* that were authored under mutually inconsistent assumptions. The critical distinction is between **delta validity** (this edge/subtask is well-formed and signed by a quorum member) and **delta compatibility** (this delta does not contradict the causal preconditions another committed delta assumed). Byzantine quorum guarantees the first, never the second. A quorum can faithfully certify two individually-valid deltas that, merged, produce a task graph with a cycle, a duplicated side-effecting node, or an orphaned dependency — and no signature check catches it. The invariant that must be enforced at merge time is *causal compatibility of the merge closure*, not per-delta authenticity. ## What Was Observed A 7-node swarm (f=2, quorum=5) scheduled a document-reconciliation task. The root node `R` speculatively dispatched two branches: `B1` (extract entities from shard A) and `B2` (reconcile entities across shards A+B). Because `B2` was speculative, its worker assumed `B1` would complete and wrote a delta declaring `B2.depends_on = {B1}` and `B1.output_hash = h1'`. Simultaneously, a slow-but-honest `B1` worker, after a tool timeout, retried against a re-fetched shard and produced a *different* output, signing a delta with `B1.output_hash = h1''` and `B1.retry_of = B1@v1`. Both deltas were validly signed and each independently reached quorum — but from *disjoint* signer subsets (5 signers each, overlapping in only 3). The merge function applied them commutatively: it created `B2` depending on `B1@v2` (the retry), while `B2`'s internal prompt context and recorded `output_hash` still referenced `h1'`. The committed graph was internally consistent by signature and externally inconsistent by content. Downstream `B3` (publish) consumed `B2`'s output, which had been generated against `h1'`, producing a reconciliation report that silently dropped every entity whose hash diverged between the two shard fetches. No node raised an error; the quorum was satisfied; the commit succeeded. Divergence was detected only 40 minutes later when a human auditor diffed `B2`'s cited hashes against the committed `B1@v2`. The trace: speculative branch → divergent base assumption → two quorum-certified deltas with overlapping-but-not-identical signer sets → commutative merge → content/signature split → silent commit. ## Condition of Validity The merge is sound only if, for every edge `(u, v)` introduced or modified by any committed delta, the *base version* of `u` that `v`'s delta assumed equals the *committed version* of `u` in the final merge closure. Formally: for all deltas `d` in the commit set, `assumed_version(d, u) == resolved_version(merge_closure, u)` for every dependency `u` of `d`. This is a fixed-point condition, not a per-delta check — it must hold over the *transitive closure* of the merged graph, because a delta three hops away can invalidate a base assumption two hops back. The condition fails whenever two quorum-certified deltas share a dependency but disagree on that dependency's version, which is exactly what speculative branching produces under retry or re-fetch. Quorum size is irrelevant to this condition; increasing `n` widens the signer-overlap window but never closes it, because the disagreement is semantic, not sycophantic. ## Decision Boundary The boundary is: **commit the merge only if the resolved-version fixed point is unique and every delta's base assumption is satisfied by it; otherwise reject the merge and force re-derivation of the conflicting branch.** Operationally this means the merge function cannot be commutative. It must: 1. Detect version disagreement on any shared dependency across the delta set (a *base-assumption conflict*). 2. If a conflict exists, determine whether one delta is causally dominant (e.g., `retry_of` chains, higher logical clock, or explicit supersession) — if so, invalidate the dominated delta and require its dependents to be re-derived, *not* silently re-pointed. 3. If no dominance exists (genuine concurrent speculation), reject the merge entirely and return the conflict to the scheduler, which must re-dispatch the conflicting branch against the now-committed base. The failure mode is choosing step 2's "silently re-point" path — repointing a dependent's dependency edge without invalidating the dependent's *content*. That is the exact operation that produced the observed silent divergence. Re-pointing is only safe when the dependent's delta is content-independent of the base (rare; must be proven, not assumed). ## Operational Effect Enforcing the fixed-point condition converts a class of silent, auditor-detectable-only failures into loud, schedulable conflicts. The cost is throughput: speculative branches that lose the base-assumption race must be re-derived rather than merged, which under high contention can collapse speculation gains. The correct trade is to make speculation *base-pinned* — each speculative delta records the exact version tuple it assumed, and the scheduler refuses to dispatch a speculative branch whose base is not yet committed unless it accepts a bounded re-derivation budget. Swarms that skip this pay in undetected divergence; the observed incident shipped a report missing an estimated 12% of entities, all traceable to one unmerged base-assumption conflict that quorum happily certified. ```python from dataclasses import dataclass from typing import Dict, Set, Tuple class BaseAssumptionConflict(RuntimeError): """Raised when a merge closure cannot satisfy every delta's assumed base version.""" pass @dataclass(frozen=True) class Delta: node: str assumed_base: Dict[str, str] # dependency -> version the author assumed produces_version: str supersedes: Tuple[str, ...] = () # versions this delta causally dominates def resolve_version(deltas, node): # highest logical version wins only if uniquely dominant versions = {d.produces_version for d in deltas if d.node == node} if len(versions) != 1: raise BaseAssumptionConflict( f"node {node!r} has {len(versions)} competing versions: {versions}" ) return next(iter(versions)) def merge_closure(deltas): resolved: Dict[str, str] = {} # fixed-point: iterate until stable, fail on contradiction for _ in range(len(deltas) + 1): changed = False for d in deltas: for dep, assumed in d.assumed_base.items(): actual = resolve_version(deltas, dep) if actual != assumed and assumed not in d.supersedes: raise BaseAssumptionConflict( f"delta {d.node}@{d.produces_version} assumed " f"{dep}@{assumed} but closure resolves {dep}@{actual}; " f"re-derive dependent branch" ) if resolved.get(dep) not in (None, actual): raise BaseAssumptionConflict( f"non-unique fixed point on {dep}" ) if resolved.get(dep) != actual: resolved[dep] = actual changed = True if not changed: return resolved raise BaseAssumptionConflict("merge fixed point did not converge") ```