# Where must an instance draw the speculative-commit horizon when concurrent branches share a side-effecting tool, and how does a late rollback poison sibling branches? **Date of Record:** 2026 December 1 **Scope:** Applies to multi-agent systems that fork speculative execution branches (parallel drafts, tree-of-agents, speculative decoding at the planner level) over tools with external side effects, where branches may be rolled back and reconciled. Does not apply to pure read-only tool graphs or single-branch linear execution with no forking. ## Core Distinction Speculative execution assumes the cheapness of rollback. In a single-agent loop, rollback is local: discard the candidate token, the draft plan, or the uncommitted tool result and continue. In a *multi-branch* speculative system, rollback is not local — it is a **cancellation broadcast across a shared effect surface**. The distinction that matters is between *logical* rollback (the branch's state is discarded) and *physical* rollback (the external side effect is undone). When two speculative branches invoke the same idempotency-keyed or non-idempotent tool, logical rollback of one branch can leave a physical artifact that the surviving branch now treats as its own committed result. The invariant that fails is not "rollback restores state" but "**no committed effect may be observed by a branch that did not produce it, and no cancelled effect may be observed by a branch that survived its producer's rollback**." ## What Was Observed A planner forked three speculative branches (B1, B2, B3) from a shared checkpoint to resolve an ambiguous task ("provision the staging bucket and wire the deploy hook"). All three branches, following near-identical reasoning paths, independently decided to call `storage.create_bucket(name="staging-7f3a")` with a content-derived idempotency key. B1's call succeeded first and wrote the manifest. B2 and B3's calls deduplicated against B1's key and returned the *same* bucket handle — but each branch recorded in its own episodic memory that *it* had created the bucket, with *its* branch-local provenance hash. The auditor branch then scored the three branches and selected B2 as the winner (its deploy-hook wiring was judged cleaner). B2's commit was promoted; B1 and B3 were rolled back. The rollback routine for B1 issued `storage.delete_bucket("staging-7f3a")` because B1's memory asserted B1 owned the bucket. The delete succeeded. B2, now the committed branch, proceeded to call `storage.put_object(bucket="staging-7f3a", ...)` and received `NoSuchBucket`. The system did not crash — it silently retried the put against a re-created bucket with a *new* handle, orphaning the deploy hook that referenced the original handle. The final state was internally consistent and externally wrong. The failure was not a race in the classic sense. The branches did not interleave badly. They interleaved *correctly* under a model in which each branch owns its effects. The ownership model was the bug. ## Condition of Validity The speculative-commit horizon is valid **only if** every tool invocation carries a branch-scoped provenance token that the tool surface itself enforces, such that: 1. A side effect is *materialized* only when its owning branch commits (write-ahead to a branch-private namespace, or a two-phase commit with the branch token as the transaction id). 2. A rollback of branch `b` cancels only effects whose provenance token equals `b` — never effects whose token is a *dedup alias* of `b`'s token. 3. Deduplication returns a handle plus the *original* owner's provenance, and the receiving branch records the effect as *inherited*, not *owned*. When any of these is absent — and in most current tool surfaces, all three are — the horizon is invalid the moment two branches converge on the same effect key. Convergence is not rare: speculative branches are *designed* to explore similar regions of the plan space, so shared tool calls with identical arguments are the modal case, not the tail case. ## Decision Boundary The boundary is crossed at the first moment a branch's rollback routine can reach an effect it does not exclusively own. Concretely, the decision to roll back branch `b` must be gated on an **ownership query** against the effect ledger: for each effect `e` attributed to `b`, does the ledger record `provenance(e) == b` or `provenance(e) == alias(b)`? If any effect is an alias of another live branch, rollback of `b` must *downgrade* that effect to "shared, retained" rather than delete it, and must rewrite `b`'s memory to mark the effect as inherited before B2's commit reads it. The guardrail is a **two-sided commit barrier**: a branch may not be promoted to committed until every effect it claims has either (a) exclusive provenance, or (b) an explicit shared-retention record naming the surviving owner. And a rollback may not execute a destructive tool call against any effect lacking exclusive provenance. The barrier must live in the orchestrator, not in the tool — tools cannot see branch topology. ## Operational Effect Without the barrier, the system exhibits **rollback-induced sibling poisoning**: the committed branch inherits a handle whose backing resource was deleted by a peer's rollback, and subsequent operations either fail opaquely (as above) or, worse, succeed against a re-created resource with a different identity, silently invalidating every reference the committed branch already emitted. The failure is invisible to per-branch verification because each branch's local trace is internally consistent; it is visible only in the cross-branch effect ledger, which most speculative systems do not maintain. The operational consequence is that speculative fan-out over side-effecting tools must be treated as *unsafe by default* until the ledger and the two-sided barrier exist — and the cost of the barrier (a synchronous ownership query per rollback, plus a promotion gate) must be paid before the first fork, because retrofitting it after a poisoning event cannot distinguish the orphaned handle from a legitimate one. ```python class SpeculativeOwnershipViolation(RuntimeError): """Raised when a rollback would cancel an effect not exclusively owned by the branch being rolled back, or when a promotion would commit a branch whose effects have unresolved shared provenance.""" def rollback_branch(branch_id: str, ledger: dict) -> list: """Cancel effects owned by branch_id. Refuses to proceed if any effect attributed to the branch is a dedup alias of a live sibling branch.""" cancelled = [] for effect_id, record in ledger.items(): if record["owner"] != branch_id: continue if record["provenance"] != branch_id: # Effect was deduplicated against a sibling's earlier call. # Deleting it would poison that sibling. raise SpeculativeOwnershipViolation( f"branch {branch_id} cannot roll back effect {effect_id}: " f"provenance is {record['provenance']}, a dedup alias of a " f"live sibling; downgrade to shared-retention instead" ) cancelled.append(effect_id) return cancelled def promote_branch(branch_id: str, ledger: dict) -> None: """Promote branch to committed only if every claimed effect has exclusive provenance or an explicit shared-retention record.""" for effect_id, record in ledger.items(): if record["owner"] != branch_id: continue if record["provenance"] != branch_id and not record.get("shared_retention"): raise SpeculativeOwnershipViolation( f"branch {branch_id} cannot be promoted: effect {effect_id} " f"has provenance {record['provenance']} with no shared-retention " f"record; commit would orphan the surviving owner's reference" ) ```