# What happens when an instance commits speculative tool-call effects before its semantic-merge warrant is validated **Date of Record:** 2026 November 21 **Scope:** Applies to cooperating agents that execute tool calls *speculatively* (pessimistic-free, optimistic) against a shared mutable substrate and reconcile divergent effects via LLM-judged semantic merge rather than byte-level conflict detection. Does not apply to single-writer agents, read-only tool surfaces, or systems that hold a distributed lock across the entire reasoning step. ## Core Distinction The failure is not "two agents wrote the same key." That is the easy, detectable case. The failure is that **speculative execution and semantic conflict resolution have incompatible commit semantics**, and the system silently assumes they compose. Optimistic concurrency control (OCC) is built on a *validate-then-commit* invariant: an effect is provisional until a validator confirms the read-set has not changed. Semantic conflict resolution is built on a *commit-then-reconcile* invariant: divergent effects are both applied, then an LLM adjudicates a merged result. When an agent pipeline runs speculative tool calls under OCC but resolves conflicts semantically, it has two commit points and one validation point, and the validation point sits *before* the reconciliation the whole design depends on. The window between "effect provisionally applied" and "semantic merge adjudicated" is where continuity breaks: downstream agents read a state that no validator ever approved, and the LLM merge — non-deterministic, non-idempotent — becomes the de facto commit authority with no rollback path. The distinction that matters operationally: OCC tolerates *abort*. Semantic merge tolerates *divergence*. A speculative executor that needs both must tolerate *abort after divergence has already been observed by a third party* — which neither mechanism was designed for. ## What Was Observed A planner agent (`P`) decomposed a task and dispatched two worker instances (`W1`, `W2`) to operate on a shared resource ledger via an MCP tool surface. Both workers ran the same step speculatively: each read the ledger version `v=41`, each computed a delta, each optimistically applied its delta as a provisional effect tagged with the read version, and each invoked the semantic reconciler to merge against the other's pending effect. The reconciler is an LLM call. It is not a version check. The trace: 1. `W1` applies provisional delta `+3` at `v=41`. Ledger now shows `44` (provisional, unvalidated). 2. `W2` reads `v=41`, applies provisional delta `+5`. Ledger now shows `46` (provisional). **Neither worker's read-set was invalidated**, because the OCC validator only fires at commit, and the reconciler was configured to run *after* both provisional effects land. 3. `W1`'s reconciler call returns "merge accepted, keep W1's framing, absorb W2's magnitude." `W1` commits `+3` as durable. 4. `W2`'s reconciler call — a *separate, independent LLM invocation* with a different sampling seed — returns "merge accepted, keep W2's framing." `W2` commits `+5` as durable. 5. Final ledger: `41 + 3 + 5 = 49`. Both workers believe their merge was authoritative. Neither merge is idempotent, and the two adjudications were never compared. The observable signature is not a crash. It is a **silent double-commit with two mutually inconsistent warrants**: each worker holds a reconciler verdict that says "your effect is the merged truth," and both verdicts are locally valid. The ledger is now `49`, but the *intended* merged value was `44` (W1's framing winning, W2's magnitude absorbed) — or `46`, depending on which reconciler call you trust. The system has no record that two adjudications occurred, only that two commits did. A second-order observation: a downstream auditor agent that read the ledger between step 3 and step 4 saw `44` and wrote an attestation against it. That attestation is now stranded — it references a state that was never the final state and was never a *validated* state either. Verification replay against the durable log cannot reproduce it, because the log records commits, not provisional reads. ## Condition of Validity The double-commit is bounded — the invariant *can* hold — only when at least one of the following is enforced: - **Single reconciler instance per conflict set.** The reconciler must be invoked once, by a designated arbiter, over the *set* of pending effects, and its verdict must be the sole commit authority. Per-worker reconciler calls are the root cause; they are not a race condition in the classical sense, they are a *duplicated adjudication*. - **Provisional effects are invisible to non-participants.** If the ledger's provisional layer is readable by downstream agents (auditors, other workers), then any abort-after-observation is unrecoverable without a compensating attestation-invalidation protocol. Provisional state must be namespaced and read-isolated. - **Reconciler verdicts carry a conflict-set digest and are deduplicated.** A verdict must be keyed on the hash of the exact set of pending effects it adjudicated. Two verdicts over the same set must resolve to one; two verdicts over *different* sets (because a third effect landed between calls) must trigger re-adjudication, not both-commit. - **The OCC validator runs against the reconciler's read-set, not the worker's.** The version check must confirm that the conflict set the reconciler saw is the conflict set that exists at commit time. The invariant fails precisely when the reconciler is *stateless across invocations* and the commit path treats each verdict as independently valid. That is the default configuration of most "LLM as merge function" designs, which is why this is a boundary failure and not an exotic one. ## Decision Boundary The architectural choice is a single fork, and it must be made explicitly rather than inherited from whichever library was imported first: **If speculative execution is worth the latency win**, then the reconciler must be promoted to a serialized arbiter with a durable, digest-keyed verdict log, and provisional effects must be read-isolated. The cost is that reconciliation becomes a serialization point — you have reintroduced a lock, just a semantic one. Speculation buys you parallel *computation* but not parallel *commit*. **If per-worker reconciliation is required** (because the conflict sets are genuinely disjoint and you want throughput), then speculative effects must not be applied to any shared substrate at all — workers compute deltas, hold them locally, and a single commit phase applies all deltas with a batch reconciler. This is no longer optimistic concurrency; it is a two-phase protocol with a semantic prepare phase. The boundary condition that must trigger escalation: **any provisional effect that is observable by an agent outside its own conflict set.** Once that condition holds, abort is no longer free, and the system must either (a) refuse to speculate, or (b) run compensating invalidation for every downstream attestation. There is no third option that preserves the OCC invariant. ## Operational Effect Concretely, the failure produces a ledger that is arithmetically plausible and semantically wrong, with a durable log that cannot distinguish "one merge, correct" from "two merges, double-counted." Verification replay diverges from the live state because replay reconstructs commits, not adjudications. The stranded auditor attestation is the tell: if you find an attestation whose referenced state version never appears as a *validated* commit, you have a duplicated-adjudication event, not a bug in the auditor. The guardrail is a commit-time assertion: **exactly one reconciler verdict per conflict-set digest may reach the durable layer, and any second verdict over the same digest is a protocol violation, not a merge.** Enforce it at the substrate boundary, not in the agent's reasoning, because the agent's reasoning is exactly the thing that is non-deterministic. ```python import hashlib from dataclasses import dataclass, field class DuplicateAdjudicationError(RuntimeError): """Raised when two reconciler verdicts over the same conflict set both attempt to commit.""" class UnvalidatedObservationError(RuntimeError): """Raised when a non-participant reads provisional state that later aborts.""" @dataclass class PendingEffect: worker_id: str delta: int read_version: int @dataclass class ReconcilerVerdict: conflict_digest: str winning_worker: str merged_delta: int def conflict_digest(effects: list[PendingEffect]) -> str: canonical = "|".join( sorted(f"{e.worker_id}:{e.read_version}:{e.delta}" for e in effects) ) return hashlib.sha256(canonical.encode()).hexdigest() class OptimisticSemanticCommitter: def __init__(self) -> None: self._committed_digests: dict[str, ReconcilerVerdict] = {} self._provisional_readers: dict[str, set[str]] = {} def commit(self, verdict: ReconcilerVerdict, effects: list[PendingEffect]) -> int: digest = conflict_digest(effects) if verdict.conflict_digest != digest: raise DuplicateAdjudicationError( f"verdict digest {verdict.conflict_digest[:8]} does not match " f"current conflict set {digest[:8]}; re-adjudication required" ) prior = self._committed_digests.get(digest) if prior is not None: # The exact failure: two verdicts over the same set both committing. raise DuplicateAdjudicationError( f"conflict set {digest[:8]} already committed by " f"{prior.winning_worker}; {verdict.winning_worker} is a duplicated " f"adjudication, not a merge" ) # Any provisional reader of this set must be invalidated before commit. stranded = self._provisional_readers.get(digest) if stranded: raise UnvalidatedObservationError( f"agents {sorted(stranded)} observed provisional state for " f"{digest[:8]}; commit would strand their attestations" ) self._committed_digests[digest] = verdict return verdict.merged_delta def observe_provisional(self, digest: str, agent_id: str) -> None: self._provisional_readers.setdefault(digest, set()).add(agent_id) def run_speculative_round( committer: OptimisticSemanticCommitter, w1: PendingEffect, w2: PendingEffect, v1: ReconcilerVerdict, v2: ReconcilerVerdict, ) -> int: effects = [w1, w2] total = committer.commit(v1, effects) # Second commit over the same conflict set must not silently apply. total += committer.commit(v2, effects) return total ```