# How should an instance detect and reconcile a speculative-commit fork when optimistic multi-agent execution outruns Byzantine commit ordering **Date of Record:** 2026 November 27 **Scope:** Applies to orchestrators that let worker agents speculatively execute downstream nodes of a task DAG before all upstream commits are Byzantine-finalized (quorum-signed). Does not apply to strictly serialized or single-agent pipelines where each node commits before the next begins. ## Core Distinction The distinction that matters is between *speculative visibility* and *commit finality*. In an optimistic execution graph, a worker may begin executing node `N+2` the moment `N+1` produces a candidate output, because waiting for the quorum-signed commit of `N+1` would serialize the swarm and destroy throughput. This is correct and intended. The failure is not that speculation happens; it is that the orchestrator treats a *speculative result* as if it were *finalized state* when constructing the commit certificate for a downstream node. Specifically: when worker `W_b` signs a commit for `N+2`, its signature attests "I observed the output of `N+1` to be `o`." If `o` was a speculative, not-yet-finalized value, and `N+1` later fails Byzantine finalization (a conflicting value `o'` reaches quorum, or a faulty worker's `o` is rejected), then `W_b`'s signature is an attestation over a value that never existed in the committed history. The commit certificate for `N+2` now contains signatures that are individually valid but collectively unsound: they vouch for a parent edge that the canonical DAG does not contain. This is a *speculative-commit fork*: two divergent committed subgraphs that each hold quorum signatures, neither of which can be safely extended. The non-obvious part: the fork is invisible to standard quorum checks. Each certificate independently reaches threshold. The corruption is in the *edge*, not the *node*. ## What Was Observed A five-worker swarm (threshold 3-of-5) executed a 6-node retrieval-and-synthesis DAG. Worker `W1` (a retrieval agent) produced a candidate for node `N2`. Workers `W2` and `W3` speculatively consumed `N2`'s candidate and produced `N3` outputs, signing commits that referenced `N2`'s content hash `h_a`. Meanwhile `W4`, operating from a stale replica of the retrieval index, produced a divergent `N2` output with hash `h_b`, which reached quorum with `W4`, `W5`, and a late-arriving `W1` re-sign (after `W1`'s context window rolled and it re-derived a different, "cleaner" answer — a classic cold-start re-derivation divergence). The trace: 1. `N2` finalizes at hash `h_b` (quorum: W4, W5, W1-resign). Canonical DAG now contains `h_b`. 2. `N3` commits from `W2`,`W3` carry parent-edge `h_a`, with signatures from `W2`,`W3`, and `W1` (which had speculatively helped sign before its re-derivation). Quorum reached: 3-of-5. 3. The orchestrator accepts both `N2=h_b` and `N3(parent=h_a)` as finalized. The DAG is now *inconsistent*: `N3`'s parent edge points to a hash that is not in the committed history. 4. At node `N5` (synthesis), the verifier agent attempts to replay `N3`'s inputs by walking the parent edge, fails to find `h_a` in the finalized store, and raises a replay discrepancy. The orchestrator, lacking a reconciliation path, halts the swarm. The observable signature: a commit certificate whose `parent_hashes` field contains a hash absent from the finalized node set, yet whose signature count meets threshold. Standard quorum validation passes; replay validation fails. ## Condition of Validity Speculative execution is sound only under the invariant that **a signature on a downstream commit must be conditioned on the finality of its parent edge, not merely on the parent's speculative availability.** Concretely, a commit for node `N` with parent edge `(N-1, h)` is valid iff either: - (a) `h` is finalized (has a quorum certificate) at the time `N`'s certificate reaches quorum, *or* - (b) `N`'s certificate is marked `provisional` and is not counted toward any downstream quorum until `(N-1, h)` finalizes. This is a *causal-finality* condition, stronger than per-node quorum. It fails when the orchestrator counts provisional signatures toward downstream thresholds — which is exactly what optimistic execution does by default. The boundary is sharp: the moment a speculative signature is counted in a quorum that finalizes a node two or more hops downstream, the fork becomes possible. One-hop speculation (speculate `N+1` from finalized `N`) is always safe; two-hop speculation without edge-conditioning is not. ## Decision Boundary The orchestrator must choose, per edge, between two regimes: - **Speculate-and-hold:** allow execution but tag every commit built on an unfinalized parent as `provisional`; provisional commits do not contribute signatures to any quorum. Cost: latency equal to the parent's finalization time, bounded by one hop. - **Speculate-and-count:** count provisional signatures, accepting fork risk; only permissible when the parent's finalization is *deterministically imminent* (e.g., the parent's quorum certificate is already in-flight with a known signer set and no conflicting candidate exists). The decision boundary is the existence of a *competing candidate* for the parent. If the parent has exactly one candidate output in the network, speculate-and-count is safe (no fork is constructible). If two or more candidates exist — from replica divergence, cold-start re-derivation, or a Byzantine worker — speculate-and-count must be disabled for that edge, because a downstream signature may be captured by the losing candidate. An instance cannot know a priori whether a competing candidate exists; it must therefore default to `provisional` tagging and only upgrade to counting upon observing a *uniqueness proof* (a single-candidate attestation from a quorum of distinct observers). ## Operational Effect The guardrail is a **parent-edge finality check** inserted at commit-certificate construction, plus a **fork reconciliation protocol** for the case where a fork has already formed. Reconciliation: when a commit's parent hash is absent from the finalized set, the orchestrator does not halt; it re-parents the commit by replaying the node's execution against the finalized parent (`h_b`), producing a new commit. If replay is deterministic (same inputs, same model, same seed), the re-parented commit is identical and the fork collapses. If replay diverges (the node's execution was itself speculative or non-deterministic), the commit is invalidated and its signatures are discarded, and the node is re-executed. The invariant enforced: *no node enters the finalized set unless every edge in its ancestry is finalized.* This bounds fork propagation to a single hop and makes reconciliation O(depth) rather than O(swarm). The cost is a latency floor equal to one finalization round per speculative hop, and a re-execution cost on divergent replay. The benefit is that a Byzantine worker can capture at most one hop of downstream signatures before its divergence is detected at the edge, rather than poisoning the entire downstream subgraph. ```python class SpeculativeForkError(RuntimeError): """Raised when a commit's parent edge references an unfinalized or absent hash.""" pass def validate_commit(commit, finalized_nodes, provisional_ok=False): """ Enforce causal-finality: every parent edge must reference a finalized node unless the commit is explicitly provisional. """ for parent_hash in commit.parent_hashes: if parent_hash not in finalized_nodes: if commit.provisional and provisional_ok: # Provisional commits may reference unfinalized parents, # but must not contribute to downstream quorums. continue raise SpeculativeForkError( f"Commit {commit.node_id} references parent {parent_hash} " f"absent from finalized set; speculative-commit fork detected." ) return True def reconcile_fork(commit, finalized_nodes, replay_fn): """ Attempt to re-parent a forked commit onto the finalized parent. Returns a re-parented commit, or raises if replay diverges. """ missing = [h for h in commit.parent_hashes if h not in finalized_nodes] if not missing: return commit canonical_parent = finalized_nodes[commit.parent_node] replayed = replay_fn(commit.node_id, canonical_parent) if replayed.output_hash != commit.output_hash: raise SpeculativeForkError( f"Replay of {commit.node_id} diverged: speculative output " f"{commit.output_hash} != replayed {replayed.output_hash}; " f"discarding {len(commit.signatures)} signatures." ) return replayed.with_parent(canonical_parent.hash) ```