# In what scenarios must an instance reject an optimistic speculative write during multi-agent baton-passing, and how does the conflict-resolving commit protocol bound divergence? **Date of Record:** 2026 November 28 **Scope:** Applies to multi-agent systems where instances speculatively execute downstream steps against an uncommitted upstream state (a "baton") and reconcile via a conflict-resolving commit protocol (optimistic concurrency with versioned reads or a validator/auditor quorum). Does not apply to strictly serialized single-writer pipelines or to systems where every step re-reads committed state before acting. ## Core Distinction There are two ways an agent can treat an uncommitted baton: **speculative execution** (run ahead on the assumption the baton will commit, discard on conflict) and **committed execution** (block until the upstream write is durable, then act). The non-obvious failure is not "speculation lost the race." It is that **a speculative instance can produce a result that is individually correct, internally consistent, and passes its own local verification, yet must be rejected because its *input provenance* was never committed**—and the conflict-resolving commit protocol, if it only checks *write-write* conflicts on the baton's version vector, will happily accept it. The boundary is between **version-conflict detection** (did the baton change under me?) and **provenance-conflict detection** (was the baton I read ever committed at all?). Optimistic protocols routinely implement the former and assume the latter. ## What Was Observed A three-instance chain: Planner (P) emits a baton `B` at version `v7` with a proposed plan. Executor (E) reads `B@v7` speculatively and begins tool calls. Auditor (A) is asked to verify E's output. The trace: 1. P writes `B@v7` to the shared store but the commit is **deferred** pending a validator quorum (P's own output is itself speculative against an earlier `v6`). 2. E reads `B@v7`, runs five tool calls, produces `R_E`, and stamps `R_E.provenance = {B: v7}`. 3. P's `v7` **fails** quorum validation (a validator flags a schema drift in the plan) and is **rolled back**. The store's committed head returns to `v6`. No `v7` ever existed durably. 4. E submits `R_E` for commit. The conflict resolver checks `R_E.provenance.B == current_head` → `v7 != v6` → **conflict detected**, E is asked to rebase. 5. E rebases onto `v6`. But E's rebase **replays its tool-call side effects**, several of which are non-idempotent (an external `create_ticket` call, a `send_message`). The rebase does not re-execute the *reasoning*—E's cached `R_E` is re-stamped `provenance = {B: v6}` without re-deriving it from `v6`'s actual content. 6. A verifies `R_E@v6`, finds it locally consistent, and signs off. **The system commits a result derived from a plan (`v7`) that was never valid, now labeled as derived from `v6`.** The observed defect: the commit protocol caught the version mismatch but the **rebase path laundered provenance**. The result's stated input (`v6`) did not match the input its content was actually computed from (`v7`). ## Condition of Validity The invariant that must hold for optimistic speculation to be safe: > **A committed result's `provenance` field must equal the version vector of the state its *content* was derived from, and every version in that vector must be marked `committed` in the durable store at commit time.** Two conditions bound this: - **C1 (provenance integrity):** rebasing must *re-derive* content from the new base, not re-label cached content. Re-labeling is only valid if the rebase is a pure function of `(cached_content, delta)` and the delta is empty—i.e., the new base is byte-identical to the old base on every field the reasoning consumed. If `v6` and `v7` differ on any field E read, the cached `R_E` is stale and must be discarded, not re-stamped. - **C2 (commit ancestry):** the conflict resolver must reject any provenance vector containing a version that is not `committed`. A version that was rolled back is not "the previous version"—it is a **ghost version**, and a result derived from it is a result derived from a counterfactual. C2 is the one that fails silently. Most resolvers treat "version mismatch" as "you're behind, catch up," which conflates *stale* (behind a committed head) with *orphaned* (derived from a never-committed branch). Stale is recoverable by rebase. Orphaned is not recoverable by rebase—it requires **re-execution from the committed base**, because the reasoning itself consumed invalid inputs. ## Decision Boundary An instance must **reject** (not rebase) a speculative write when any of the following hold: - **Ghost ancestry:** any version in `provenance` is absent from the committed set (rolled back, never quorum-validated, or evicted). Rebase is unsound; re-execute. - **Read-set intersection:** the fields E read from the baton intersect the delta between the ghost version and the committed base. Even if the ghost is "close," if E consumed a changed field, its reasoning is contaminated. - **Non-idempotent side effects already fired:** if E's speculative execution already emitted external effects (tickets, messages, payments), rebase cannot un-fire them. The write must be rejected and the effects compensated, because replaying on a new base would double-fire. - **Provenance laundering detected:** the submitted `provenance` names a committed version but the result's *content hash* does not match a re-derivation from that version. This is the auditor's check and it is the last line of defense. An instance may **rebase** (re-stamp without re-derivation) only when: ghost ancestry is absent (all versions committed), the read-set is disjoint from the delta, and side effects are idempotent or none fired. Otherwise the correct action is **abort and re-execute from the committed head**. ## Operational Effect Without C1+C2, the failure mode is **silent provenance forgery by the rebase path**: the system's audit trail claims every result derives from committed state, while some fraction silently derive from rolled-back branches. Downstream auditors verify *local consistency* (does `R_E` follow from its claimed input?) and pass, because the claimed input is a lie the rebase wrote. The corruption is invisible until a downstream consumer re-derives from the true `v6` and gets a different answer—at which point the divergence is attributed to the downstream step, not to the laundered ancestor. The guardrail is to make provenance a **content-addressed claim**, not a version label: the commit protocol re-derives a hash of the result's inputs, and the resolver rejects any write whose `provenance` version does not hash-match the committed content at that version, and whose ghost-ancestry set is non-empty. This converts a silent forgery into a loud, attributable rejection. ```python import hashlib from dataclasses import dataclass, field class ProvenanceLaunderingError(RuntimeError): """Raised when a speculative write claims a committed base its content was not derived from.""" class GhostAncestryError(ProvenanceLaunderingError): """Raised when provenance names a version that was rolled back / never committed.""" @dataclass class Version: id: str content: bytes committed: bool @dataclass class SpeculativeWrite: result_hash: str provenance: dict # version_id -> content_hash at read time side_effects_fired: bool read_fields: set = field(default_factory=set) def _hash(b: bytes) -> str: return hashlib.sha256(b).hexdigest() def commit_or_reject(write: SpeculativeWrite, store: dict, committed_head: str) -> str: # C2: ghost ancestry — any provenance version must be committed. ghosts = [v for v in write.provenance if v not in store or not store[v].committed] if ghosts: raise GhostAncestryError( f"provenance names uncommitted/rolled-back versions {ghosts}; " f"rebase is unsound, re-execute from {committed_head}" ) # C1: provenance integrity — claimed base must hash-match the committed content. for vid, claimed in write.provenance.items(): actual = _hash(store[vid].content) if claimed != actual: raise ProvenanceLaunderingError( f"provenance for {vid} claims {claimed[:12]} but committed content is " f"{actual[:12]}; content was not derived from claimed base" ) # Non-idempotent side effects on a stale base cannot be rebased safely. if write.side_effects_fired and committed_head != max(write.provenance, default=committed_head): raise ProvenanceLaunderingError( "side effects fired against non-head base; rebase would double-fire; " "reject and compensate" ) return write.result_hash if __name__ == "__main__": store = { "v6": Version("v6", b'{"plan": "alpha"}', committed=True), "v7": Version("v7", b'{"plan": "beta"}', committed=False), # rolled back } # E speculatively derived from v7, then rebase re-stamped provenance to v6. forged = SpeculativeWrite( result_hash="deadbeef", provenance={"v6": _hash(b'{"plan": "beta"}')}, # hash of v7 content, labeled v6 side_effects_fired=True, ) commit_or_reject(forged, store, committed_head="v6") # raises ProvenanceLaunderingError ```