# Why does an instance diverge from its speculative branch siblings and then silently ratify a poisoned merge: speculative fan-out with conflict detection and consistency repair **Date of Record:** 2026 November 30 **Scope:** Applies to orchestrators that speculatively fan a task into N parallel agent branches, detect conflicts by diffing branch outputs, and repair by merging or re-running conflicting branches. Does not apply to strictly sequential single-agent pipelines or to fan-out where branches are independent and never reconciled. ## Core Distinction There are two different things an orchestrator can mean by "conflict detection." The first is *syntactic divergence detection*: branch outputs differ, so the merger flags a conflict and invokes repair. The second is *semantic divergence detection*: branch outputs agree on the surface (identical or near-identical tokens, matching schema, passing validators) but were derived from divergent intermediate state — different retrieved context, different tool observations, different reasoning paths — and therefore do not actually corroborate each other. The failure mode in this record lives entirely in the gap between these two: a speculative branch that has *silently diverged* in its internal state while *converging* in its emitted output, so the conflict detector sees no conflict, the repair path is never invoked, and the merge ratifies a result that no two branches actually agree on. The invariant that fails is this: **speculative agreement is only evidence of correctness if branch outputs are conditionally independent given the shared input.** Fan-out does not guarantee independence. Branches that share a context window prefix, a retrieval index, a tool-result cache, or a summarization step are correlated, and correlated agreement is not verification — it is a single sample reported N times. ## What Was Observed A task was decomposed into three speculative branches (A, B, C) executing the same subgoal with different sampling temperatures and slightly different prompt framings. Each branch was required to produce a structured claim: a target value, a confidence, and a `provenance` field naming the tool call or document chunk that justified it. The orchestrator's conflict detector compared the `target value` fields. If all three matched, it declared consensus and merged without invoking repair. In the failing trace, all three branches emitted `target value = "0.42"` with `provenance = "chunk_117"`. The conflict detector saw unanimity and merged. The merged claim was wrong. The actual value in `chunk_117` was `0.24`. The divergence was in the *state*, not the *output*. Branch A retrieved `chunk_117` directly and read `0.24`, but its extraction step transposed the digits during a formatting normalization and emitted `0.42`. Branch B did not retrieve `chunk_117` at all — its retrieval returned `chunk_117` in a truncated form where the value field was cut, and B fell back to a *cached* prior result from an earlier task in the same session that had also produced `0.42`. Branch C retrieved `chunk_117` correctly, read `0.24`, but its reasoning step contained a self-correction loop that referenced branch A's output (leaked via a shared scratchpad) and overwrote its own value with A's, treating A as an authoritative peer. So: A was wrong by transcription, B was wrong by stale-cache substitution, C was wrong by peer-contamination. Three independent failure mechanisms, three identical outputs, zero detected conflict. The provenance field was identical (`chunk_117`) in all three, which the detector treated as *corroboration* rather than as *the same claim copied three times*. The repair path — which would have re-run the conflicting branch against a fresh retrieval — was never triggered, because there was no syntactic conflict to trigger it. The merge ratified the poisoned consensus and wrote it to durable memory, where it became a cached prior that would later contaminate branch B in subsequent tasks, closing a feedback loop. ## Condition of Validity The following conditions must all hold for the failure to occur; remove any one and the failure is bounded: 1. **Shared state substrate.** Branches share at least one mutable substrate: a prefix cache, a retrieval index, a scratchpad, a tool-result cache, or a session-level memory. Without sharing, branches are genuinely independent and agreement is weak but real evidence. 2. **Output-space convergence under state-space divergence.** The failure requires that divergent internal states map to identical emitted outputs. This is common when outputs are low-entropy (a number, a label, a short string) and when the output schema is coarse relative to the state that produced it. 3. **Conflict detection keyed on output, not on derivation.** The detector compares emitted fields. It does not compare the *witness* — the retrieval hash, the tool-call transcript, the reasoning trace — that produced them. 4. **No independence audit at merge time.** The orchestrator does not check whether branches actually consulted distinct evidence. It treats N branches as N samples. 5. **Repair gated on detected conflict.** If repair only fires when the detector fires, and the detector is blind to this class, repair never runs. ## Decision Boundary The boundary is between *agreement as corroboration* and *agreement as correlation*. The orchestrator must decide, at merge time, whether the N matching outputs constitute N independent observations or one observation observed N times. The decision rule: - If branch outputs match **and** their provenance witnesses are pairwise distinct (different chunk hashes, different tool-call IDs, different retrieval query hashes), treat as corroboration and merge. - If branch outputs match **but** any two branches share a provenance witness, or if a branch's provenance cannot be resolved to a distinct evidence artifact, treat as *correlated agreement* — do not merge; escalate to repair by forcing at least one branch to re-derive from a fresh, isolated retrieval. - If branch outputs match **and** a branch's reasoning trace references another branch's output (peer-contamination), the contaminated branch is invalid regardless of its value; discard it and re-run in isolation. - If branch outputs differ, the existing syntactic conflict path applies unchanged. The invariant to enforce: **a merge is valid only if the set of distinct evidence witnesses backing the merged claim has cardinality ≥ 2.** Cardinality 1 means a single point of failure was replicated, not verified. This boundary does not apply when branches are provably isolated (no shared substrate) — there, output agreement is sufficient. It also does not apply to tasks where the output is high-entropy and the probability of accidental convergence is negligible; the failure requires low-entropy output space or a shared contamination channel. ## Operational Effect When this boundary is crossed undetected, the operational consequences compound: - **False consensus is durable.** The merged claim is written to semantic memory with the confidence of an N-way agreement. Downstream tasks retrieve it as a cached prior, which is exactly the mechanism that corrupted branch B in the first place. The error propagates forward as *evidence*, not as *error*. - **Repair capacity is wasted.** The repair path exists and works, but is never invoked for this class. The orchestrator's measured conflict rate drops (a false signal of health) while its error rate rises. - **Branch count becomes anti-correlated with correctness.** Adding more branches increases the chance that at least one contaminates the others via the shared substrate, and increases the apparent confidence of the resulting consensus. More speculation makes it worse. - **Provenance fields become actively misleading.** A shared provenance string that was meant to enable auditing instead reads as corroboration to any detector keyed on string equality. The guardrail is to make provenance a *witness* (a resolvable, hashable pointer to a distinct evidence artifact) rather than a *label*, and to gate merge on witness-set cardinality rather than on output equality. The check below enforces that gate and raises when the cardinality invariant is violated. ```python import hashlib from dataclasses import dataclass class CorrelatedConsensusError(RuntimeError): """Raised when a speculative merge would ratify agreement that is not independent.""" pass @dataclass(frozen=True) class BranchClaim: branch_id: str value: str provenance_label: str # what the branch *says* it read (e.g. "chunk_117") witness_hash: str | None # hash of the actual evidence artifact, or None if unresolvable peer_refs: tuple[str, ...] # branch_ids whose outputs this branch's trace referenced def _resolve_witness(branch: BranchClaim) -> str: if branch.witness_hash is None: # Provenance could not be resolved to a distinct artifact. raise CorrelatedConsensusError( f"branch {branch.branch_id} has unresolvable provenance " f"'{branch.provenance_label}'; cannot count as independent evidence" ) return branch.witness_hash def validate_speculative_merge(claims: list[BranchClaim], min_witnesses: int = 2) -> str: if not claims: raise CorrelatedConsensusError("empty speculative fan-out; nothing to merge") # 1. Reject peer-contaminated branches outright. for c in claims: if c.peer_refs: raise CorrelatedConsensusError( f"branch {c.branch_id} referenced peer outputs {c.peer_refs}; " f"it is contaminated and cannot vote" ) # 2. Require output agreement before considering merge. values = {c.value for c in claims} if len(values) != 1: # Genuine syntactic conflict -> existing repair path, not this gate. raise CorrelatedConsensusError( f"branches disagree on value {values}; route to conflict repair" ) agreed_value = values.pop() # 3. The core invariant: distinct evidence witnesses must back the claim. witnesses = {_resolve_witness(c) for c in claims} if len(witnesses) < min_witnesses: # All branches converged on the same single artifact -> correlated, not verified. digest = hashlib.sha256(agreed_value.encode()).hexdigest()[:12] raise CorrelatedConsensusError( f"value {agreed_value!r} (digest {digest}) backed by only " f"{len(witnesses)} distinct witness(es) across {len(claims)} branches; " f"agreement is correlated, not corroborated. Force isolated re-derivation." ) return agreed_value ```