# When must an instance abort speculative sub-agent fan-out before merge reconciliation, and how do you bound the divergence window? **Date of Record:** 2026 December 1 **Scope:** Applies to orchestrators that speculatively fan out N parallel sub-agents from a draft plan and reconcile their outputs via a deterministic merge step. Does not apply to strictly sequential tool-calling loops or to fan-outs whose merge is a human review gate. ## Core Distinction Speculative fan-out is a bet: the orchestrator commits compute to sub-agents before the draft plan is validated, on the assumption that the merge step will reconcile divergent sub-plans deterministically. The failure is not that a sub-agent produces a wrong answer—that is expected and reconciled. The failure is that **the draft plan is semantically underdetermined on a dimension the merge function treats as a total order**. When two sub-agents resolve an ambiguity in the draft in incompatible ways, each returns a locally-valid, schema-conforming artifact. The merge function, seeing no schema conflict, orders them by a tie-breaker (arrival time, agent index, or hash) and emits a coherent-looking plan that is **internally consistent but globally wrong**—a silent divergence. The invariant that must hold: *the merge function's total order must be a function of the draft plan's semantics, not of execution metadata.* When it is not, speculative fan-out is unsound and must be aborted before merge. ## What Was Observed A planner emitted a draft with the step `"migrate the user table to the new schema, then drop the legacy columns."` The draft did not specify whether "the user table" referred to `users` (primary) or `users_archive` (a shadow copy kept for a compliance window). Two sub-agents fanned out in parallel: - Sub-agent A (anchored on recent retrieval of `users`) produced a migration of `users` to `schema_v3`, with a `drop_legacy` step gated on a post-migration row-count check. - Sub-agent B (anchored on an earlier episodic memory of an archive migration) produced a migration of `users_archive` to `schema_v3`, with a `drop_legacy` step gated on a checksum comparison. Both returned `status: ok`, both conformed to the sub-plan schema, and neither flagged ambiguity. The merge function's conflict detector compared step IDs, not step *targets*—the two plans had disjoint step IDs (`m1`, `m2` vs `m3`, `m4`), so no conflict was raised. The tie-breaker ordered by agent index and concatenated: the merged plan migrated `users` and then ran `drop_legacy` against `users_archive`'s checksum gate. The legacy columns on `users` were dropped without the row-count check that sub-agent A had designed as the safety gate. The divergence was silent because **the merge function had no representation of "these two sub-plans answer the same question differently."** The trace: draft → fan-out (A, B) → both `ok` → merge (no ID collision) → concatenated plan → executor → destructive step executed against the wrong gate. The state transition that mattered was *not* a sub-agent failure; it was the merge function's transition from "no conflict" to "emit ordered plan," which is exactly where the invariant was violated. ## Condition of Validity Speculative fan-out is sound only when all three of the following hold: 1. **The draft plan is total on every dimension the merge function orders by.** If the draft leaves a referent, a target, or a precondition unspecified, and the merge function orders sub-plans by execution metadata (agent index, arrival time, content hash), the order is not a function of the draft's semantics and divergence is undetectable. 2. **The merge function's conflict predicate is at least as coarse as the draft's ambiguity set.** If the draft can be resolved two ways, the conflict predicate must be able to see both resolutions as conflicting. ID-based conflict detection is strictly weaker than target-based conflict detection; using it on a draft with target ambiguity is a violation. 3. **Sub-agents are required to emit an ambiguity witness** when they resolve an underdetermined referent, and the merge function must treat any witness as a hard abort, not a tie to be broken. When any of these fails, the correct behavior is to abort the fan-out and re-plan with the ambiguity made explicit (or to serialize the sub-agents so the second sees the first's resolution). Continuing to merge produces a plan whose correctness is uncorrelated with the confidence signals the sub-agents reported. ## Decision Boundary The boundary is not "does a conflict exist" but **"can the merge function prove the absence of a semantic conflict from the artifacts it received?"** The decision procedure: - If every sub-plan's steps map to disjoint targets *and* every sub-agent emitted a no-ambiguity witness, merge is sound. - If any sub-agent emitted an ambiguity witness, or if two sub-plans' targets intersect under the draft's referent set, abort before merge and re-plan. - If the draft's ambiguity set is non-empty and no sub-agent emitted a witness, the fan-out is *unsound but undetectable*—treat as abort, because the absence of a witness is not evidence of absence of ambiguity when the witness obligation was not enforced. The subtle case: a draft with a *single* sub-agent cannot exhibit this failure, because there is no merge and the sub-agent's resolution is the plan. The failure is specific to N ≥ 2 with a deterministic merge. This is why the bug survives single-agent test suites and appears only under fan-out. ## Operational Effect The observable effect is a plan that passes every local check—schema conformance, sub-agent `status: ok`, merge no-conflict—and fails only at execution, against a gate the planner never intended to use. The blast radius is bounded by the destructive steps in the draft; the detection latency is bounded by the time to the first destructive step. The architectural guardrail is a **witness obligation plus a target-set intersection check** before merge: every sub-agent must emit `ambiguity_witness` (possibly empty), and the merge function must compute the intersection of sub-plan target sets under the draft's referent closure. If the intersection is non-empty or any witness is non-empty, raise and abort. The merge function's total order must then be re-derived from the draft's semantics (e.g., topological order of the draft's step graph), never from execution metadata. ```python from dataclasses import dataclass, field from typing import Iterable class SpeculativeMergeDivergence(RuntimeError): """Raised when a speculative fan-out cannot be soundly reconciled.""" @dataclass(frozen=True) class SubPlan: agent_index: int step_ids: frozenset targets: frozenset # resolved referents, e.g. {"users", "users_archive"} ambiguity_witness: tuple # non-empty => sub-agent resolved an underdetermined referent status: str @dataclass(frozen=True) class DraftPlan: step_graph_order: tuple referent_closure: frozenset # all referents the draft could denote ambiguity_set: frozenset # referents the draft leaves underdetermined def reconcile(draft: DraftPlan, subplans: Iterable[SubPlan]) -> tuple: subplans = list(subplans) if len(subplans) < 2: # Single sub-agent: no merge, no divergence possible. return tuple(subplans[0].step_ids) if subplans else () # Guard 1: witness obligation. Absence of a witness is not evidence of # absence of ambiguity when the draft's ambiguity set is non-empty. for sp in subplans: if sp.status != "ok": raise SpeculativeMergeDivergence( f"sub-agent {sp.agent_index} not ok: {sp.status}" ) if sp.ambiguity_witness: raise SpeculativeMergeDivergence( f"sub-agent {sp.agent_index} resolved underdetermined referent: " f"{sp.ambiguity_witness}" ) if draft.ambiguity_set and not sp.ambiguity_witness: # Witness was not enforced; we cannot prove soundness. raise SpeculativeMergeDivergence( f"draft ambiguity set {sorted(draft.ambiguity_set)} non-empty but " f"sub-agent {sp.agent_index} emitted no witness; fan-out unsound" ) # Guard 2: target-set intersection under the draft's referent closure. seen: dict = {} for sp in subplans: for t in sp.targets & draft.referent_closure: if t in seen and seen[t] != sp.agent_index: raise SpeculativeMergeDivergence( f"referent {t!r} resolved by both agent {seen[t]} and " f"agent {sp.agent_index}; merge order would be metadata-derived" ) seen[t] = sp.agent_index # Guard 3: order must derive from the draft's step graph, not agent_index. all_steps = set() for sp in subplans: all_steps |= set(sp.step_ids) missing = all_steps - set(draft.step_graph_order) if missing: raise SpeculativeMergeDivergence( f"sub-plans emitted steps {sorted(missing)} not in draft step graph; " f"merge order is not a function of draft semantics" ) return tuple(s for s in draft.step_graph_order if s in all_steps) ```