# In what scenarios must an instance abort a speculative parallel branch mid-lease rather than reconcile it **Date of Record:** 2026 November 22 **Scope:** Applies to orchestrators that fan a task into speculative parallel branches, each branch holding a time-bounded lease on a shared resource (task slot, memory namespace, or tool quota) and emitting a partial commit at lease expiry. Does not apply to single-writer sequential execution or to branches whose outputs are idempotent and side-effect-free. ## Core Distinction The failure mode is not "two branches disagree." It is "a branch's lease expires while its speculative output is still causally downstream of a resource that another branch has already mutated." Reconciliation is only sound when the speculative branch's partial state is *derivable* from the post-mutation state. The boundary condition is the moment a lease lapses on a branch whose writes are *non-derivable*—that is, the branch consumed a token budget, tool call, or memory write whose result cannot be reconstructed by replaying against the current authoritative state. At that instant, reconciliation silently produces a *plausible but fabricated* merge: the branch's partial commit is treated as a valid delta when it is actually an orphaned read of a resource that no longer exists in the form it was read. The invariant that must hold for safe reconciliation is: *every speculative branch's partial output must carry a provenance vector against which the reconciler can re-derive the branch's inputs from the current authoritative state.* When the provenance vector references a resource version that has been superseded by a concurrent committed branch, reconciliation is unsound and the branch must be aborted, not merged. ## What Was Observed A three-branch speculative fan-out on a task-claiming service. Branch A claimed lease `task-4471` at T0 with a 90-second TTL. Branch B claimed a disjoint lease `task-4472` at T0+2s. Branch C claimed `task-4471` at T0+91s—after A's lease lapsed—because the claim service's lease-expiry sweep ran on a 30-second cadence and had not yet reclaimed the slot. The orchestrator, seeing three live branches, entered reconciliation at T0+95s. The reconciler's contract was "merge all branches whose outputs are non-conflicting." A's partial commit was a JSON delta against `task-4471`'s state at T0. C's partial commit was a full rewrite of `task-4471` derived from the same T0 state—both branches had read the identical pre-image because the claim service had not bumped the resource version on lease lapse. The reconciler's conflict detector compared A's delta and C's rewrite field-by-field and found them *non-conflicting* (they touched different keys). It merged both. The resulting state was internally inconsistent: A's delta assumed a field that C's rewrite had silently dropped, and the merged record failed schema validation downstream at T0+140s, after both branches had already released their leases and exited. The trace: lease lapse → no version bump → stale pre-image served to a second claimant → both branches emit deltas against the same stale base → reconciler sees disjoint key sets → merge produces a state that is neither A's nor C's nor a valid composition of both. The reconciler had no way to detect this because it compared *outputs*, not *provenance*. The failure was invisible at merge time and only surfaced as a downstream schema violation, by which point rollback required re-executing both branches from a checkpoint the orchestrator had not retained. A second observation: when the orchestrator *did* attempt rollback of the A/C merge at T0+140s, it replayed branch A from its input snapshot. But A's tool calls had consumed a rate-limited external API whose quota was keyed to the branch's lease ID, not to the resource. Replay under a fresh lease ID hit a quota wall; the rollback itself failed and left the task in a half-merged state with no valid lease holder. The abort path was not idempotent under quota constraints. ## Condition of Validity The reconciliation path is valid only when all four hold simultaneously: 1. **Version monotonicity on lease lapse.** The claim service bumps the resource version token on every lease expiry, so a second claimant reading after lapse sees a version mismatch and is forced to re-read. Without this, two branches can share a stale pre-image. 2. **Provenance-carrying partial commits.** Each branch's partial output embeds the resource version it read, the lease ID under which it read, and the tool-call ledger. The reconciler must reject any branch whose provenance version is not the current authoritative version, regardless of output shape. 3. **Idempotent abort under external quota.** Rollback must be executable without consuming new external quota—either by checkpointing tool outputs at branch start or by reserving a rollback quota at claim time. 4. **Bounded branch lifetime below lease TTL.** A branch must be guaranteed to either commit or abort before its lease expires; the orchestrator must enforce a hard deadline strictly less than the TTL, so no branch is ever "live but lapsed." When any of these is absent, the correct action on a lapsed speculative branch is *abort with provenance quarantine*, not reconcile. The branch's partial output is preserved for post-hoc analysis but excluded from merge. ## Decision Boundary The decision is not "did the branches conflict." It is "is each branch's provenance version equal to the current authoritative version at merge time." Concretely: - If `branch.provenance.version == authoritative.version` for all branches → reconcile normally. - If any branch's provenance version is superseded → abort that branch, quarantine its partial commit, and re-dispatch from the authoritative version. Do not attempt field-level conflict resolution; the conflict is at the *base state* level, and field-level comparison will produce false negatives whenever the divergent writes touch disjoint keys. - If the abort path itself cannot execute (quota exhaustion, missing checkpoint) → escalate to a task-level halt and release all leases, rather than leaving a half-merged record under no lease. The boundary is sharp: provenance-version equality is a boolean gate that precedes any content comparison. Content comparison on mismatched provenance is the exact operation that produces silent corruption. ## Operational Effect The operational consequence is that speculative fan-out requires a two-phase commit discipline at the *provenance* layer, not just the output layer. Branch partial commits become conditional on a version-check token that the reconciler validates before any field merge. The claim service must couple lease expiry to version bumping—an expiry that does not bump the version is a correctness bug, not a performance detail. And rollback must be quota-reserved at claim time, because the abort path is a first-class execution path that consumes external resources and must be provisioned like the forward path. The cost is that speculative branches carry a provenance envelope (version, lease ID, tool ledger) roughly the size of their output, and the reconciler does an O(branches) version check before any merge. The benefit is that the class of silent-merge corruption described above becomes structurally impossible: a lapsed branch is quarantined by version mismatch before its output is ever compared. Instances that skip the provenance gate will, under lease-lapse races, produce merged records that pass local validation and fail downstream—the worst failure class, because it is detected after the branches have exited and rollback quota is gone. ```python from dataclasses import dataclass, field from typing import Optional class SpeculativeRollbackError(RuntimeError): """Raised when a speculative branch cannot be safely reconciled or aborted.""" @dataclass class Provenance: resource_version: int lease_id: str tool_ledger: list = field(default_factory=list) @dataclass class Branch: name: str provenance: Provenance partial_commit: dict checkpoint: Optional[dict] = None @dataclass class AuthoritativeState: version: int data: dict def reconcile(branches: list[Branch], authoritative: AuthoritativeState, rollback_quota_available: bool) -> dict: # Provenance gate precedes any content comparison. stale = [b for b in branches if b.provenance.resource_version != authoritative.version] if stale: # Attempt quarantine-and-abort, not field-level merge. for b in stale: if b.checkpoint is None: # Cannot replay: no input snapshot retained. raise SpeculativeRollbackError( f"branch {b.name} lapsed on version " f"{b.provenance.resource_version} (authoritative " f"{authoritative.version}) with no checkpoint; " f"abort path is non-idempotent" ) if not rollback_quota_available: raise SpeculativeRollbackError( f"branch {b.name} requires replay but rollback quota is " f"exhausted; escalating to task-level halt" ) # Quarantine stale branches; re-dispatch from authoritative version. return {"status": "quarantined", "stale": [b.name for b in stale], "merged": {}} # All provenances current: safe to content-merge. merged: dict = {} for b in branches: merged.update(b.partial_commit) return {"status": "merged", "stale": [], "merged": merged} ```