# Where must an instance halt speculative decomposition when optimistic commit outruns conflict detection **Date of Record:** 2026 November 20 **Scope:** Applies to orchestrator agents that decompose a task into parallel subtasks, let workers optimistically commit partial results against a shared mutable state store, and reconcile conflicts at a barrier. Does not cover sequential single-agent tool loops or read-only fan-out where no worker mutates shared state. ## Core Distinction The distinction that matters is between *speculative parallelism* and *unchecked commit*. A decomposer is allowed to launch N workers on the optimistic assumption that their writes are disjoint. It is not allowed to let a worker's commit become *durable* before the conflict detector has observed the write set against every sibling that could still be in flight. The failure mode is not "two agents disagree" — that is recoverable. The failure mode is **a commit that was validated against an incomplete sibling set**: worker A validated its write against workers B and C because D had not yet announced its write set, A's commit was accepted, and then D's commit arrived referencing the pre-A value of the same field. Now the reconciliation barrier sees a two-way conflict between A and D but has already published A's result downstream. The decomposer has committed to a fact that a later-arriving sibling contradicts, and the conflict detector is structurally blind to it because A's validation record says "no conflict found." This is a *happens-before* violation dressed as a data race. The optimistic protocol assumes the write-set announcement of every sibling precedes any validation. When subtask D is slow to *start* (not slow to finish), that assumption silently fails. ## What Was Observed A planning agent received a task requiring a schema migration plus a backfill plus a downstream cache invalidation. It decomposed into three workers: `migrate`, `backfill`, `invalidate`. The orchestrator issued all three with an optimistic-commit token and a 90-second conflict-detection window. `migrate` and `backfill` started immediately and announced their write sets (`schema.table_v2`, `rows[1000:5000]`). `invalidate` was gated behind a cold container pull and did not announce its write set until t+71s. At t+40s, `migrate` validated its write against the currently-known sibling set — `{backfill}` — found no overlap, and committed `schema.table_v2` as authoritative. The commit was published to the downstream consumer at t+41s. At t+71s, `invalidate` announced its write set: `schema.table_v2.mtime` and `rows[1000:5000].cache_epoch`. Its validation ran against `{migrate, backfill}` and correctly flagged an overlap on `schema.table_v2`. The barrier entered reconciliation at t+72s and resolved the conflict by rolling back `invalidate` — the *later* writer — and keeping `migrate`'s commit. The bug: `invalidate`'s rollback was correct under the protocol, but `migrate`'s downstream publication at t+41s had already caused a consumer to read `table_v2` with a stale `cache_epoch`. The reconciliation barrier reported "1 conflict, resolved" and the orchestrator recorded the task as successful. The stale cache was not detected until a downstream consistency check 14 minutes later. The conflict detector did its job; the *commit protocol* let a validated write escape the barrier before the validation set was closed. The tell in the logs was the validation record on `migrate`: `validated_against: [backfill]`. A complete validation would have listed `[backfill, invalidate]`. Nothing in the protocol required the decomposer to wait for the full sibling set before allowing validation — it only required waiting for the full set before *reconciliation*, and reconciliation is downstream of publication. ## Condition of Validity The optimistic-commit protocol is sound only under the invariant: > For every worker W, the set of siblings against which W validates must equal the set of siblings that can still produce a conflicting write at the moment W's commit becomes durable. Call this the **closed validation set** invariant. It fails in three concrete ways: 1. **Late-announcing siblings.** A sibling that has not yet started cannot have announced its write set, so it is invisible to earlier validators. Any worker that commits before the last sibling starts validates against an open set. 2. **Dynamic write-set expansion.** A sibling that announced `rows[1000:5000]` and later, mid-execution, expands to `rows[1000:8000]` (because a tool returned more rows than the planner estimated) invalidates the earlier validation retroactively. The announced set was a lie of omission. 3. **Re-entrant commits.** A worker that commits, observes the result, and commits again (retry-after-partial-failure) produces a second write whose validation set differs from the first. The first commit's validation record is now stale but still on the books. In the observed incident, condition 1 held: `invalidate` was a late-announcing sibling. The orchestrator treated "all workers dispatched" as equivalent to "all write sets known," which is false whenever worker startup is non-uniform — and startup is non-uniform whenever workers pull different container images, hit different cold caches, or queue behind different rate limiters. The decomposer's optimistic assumption is about *write disjointness*, but the protocol enforced it as an assumption about *dispatch simultaneity*, and those are not the same thing. ## Decision Boundary The boundary the orchestrator must enforce is between *speculation* (safe to do in parallel) and *durability* (must wait for the closed set). Concretely: - A worker MAY compute and stage its result against the current sibling set at any time. - A worker MUST NOT publish its result to any consumer outside the barrier until the barrier has observed the write set of every dispatched sibling, including those that have not yet started. - If the decomposer cannot bound the startup latency of a sibling, it MUST either (a) serialize that sibling's dispatch ahead of the others so its write set is known first, or (b) hold all commits until a `barrier_closed` event that fires only when every dispatched worker has announced. The decision rule for the orchestrator at commit time: ``` if not barrier_closed: stage(result) # safe defer_publication() # required else: validate_against(all_siblings) if conflict: reconcile() else: publish() # durable ``` The subtle part: `barrier_closed` is not "all workers finished." A worker can finish without ever announcing a write set (read-only subtask), and a worker can announce without finishing. The barrier closes on **write-set announcement**, not on completion. An orchestrator that waits for completion to close the barrier has already lost — the fast workers committed long ago. There is a second boundary inside reconciliation: when a late-arriving sibling conflicts with an already-published commit, the protocol must not silently roll back the later writer and call it resolved. It must escalate, because the earlier commit is already durable and the downstream consumer has already observed it. Rollback of the later writer is correct only if the earlier commit had not been published. The protocol needs to distinguish `committed-and-staged` from `committed-and-published`, and only the former is rollback-able without a downstream compensation. ## Operational Effect The practical consequence is that optimistic decomposition buys parallelism at the cost of a publication gate that must be tied to write-set closure, not to worker completion or dispatch. Systems that tie it to the wrong event will, under uniform startup, appear to work — and will fail exactly when one worker is slow to start, which is the common case in any environment with heterogeneous cold-start latency. The failure is silent: the conflict detector reports success, the barrier reports resolution, and the corruption surfaces downstream minutes later as a consistency violation with no obvious causal link to the decomposition. The guardrail is a hard state machine on each worker's commit: `STAGED → VALIDATED → PUBLISHED`, where `VALIDATED` requires a non-empty `validated_against` set equal to the barrier's current sibling roster, and `PUBLISHED` is forbidden until `barrier_closed`. Any worker that reaches `VALIDATED` with a roster smaller than the dispatched set must raise, not proceed. ```python class UnclosedValidationSetError(RuntimeError): """Raised when a worker attempts to publish against a sibling set that does not yet include every dispatched sibling's write set.""" class CommitState: STAGED = "staged" VALIDATED = "validated" PUBLISHED = "published" def publish_commit( worker_id: str, validated_against: set[str], dispatched_siblings: set[str], barrier_closed: bool, state: str, ) -> str: # The closed-validation-set invariant: a worker may only publish # against the full dispatched roster, and only after the barrier # has observed every sibling's write-set announcement. missing = dispatched_siblings - validated_against - {worker_id} if missing: raise UnclosedValidationSetError( f"worker {worker_id} validated against {sorted(validated_against)} " f"but siblings {sorted(missing)} have not announced; " f"publication would escape the barrier against an open set" ) if not barrier_closed: raise UnclosedValidationSetError( f"worker {worker_id} attempted PUBLISHED before barrier_closed; " f"stage the result and defer publication" ) if state != CommitState.VALIDATED: raise UnclosedValidationSetError( f"worker {worker_id} in state {state!r}, expected VALIDATED" ) return CommitState.PUBLISHED ```