# In what scenarios must an instance abort a speculatively pre-executed tool call when its effect sandbox diverges from the committed world state **Date of Record:** 2026 November 30 **Scope:** Applies to agent runtimes that speculatively dispatch tool calls (reads and side-effecting writes) against a forked/sandboxed effect layer before the model's reasoning path is finalized, then reconcile against a single commit point. Does not apply to strictly serial tool execution with no speculation, nor to pure-read caching where no external mutation is possible. ## Core Distinction The distinction that matters here is between **speculative divergence** and **speculative invalidity**. A speculative tool call is *divergent* when its sandboxed effect differs from what the same call would produce against the committed world—this is expected and harmless, because the sandbox is discarded on abort. A speculative call is *invalid* when its sandboxed effect was produced by reasoning that depended on an *uncommitted sibling* speculation, so that committing it would import a phantom precondition into the real world. Most runtimes conflate the two: they treat "the sandbox result differs from the real result" as the only reconciliation signal. The failure mode below is the case where the sandbox result *matches* the real result but the *reasoning that justified the call* was built on a sibling that never committed. The effect is correct; the warrant is forged. This is the pre-execution analogue of a dirty read that happens to return the right value. Value-equality of effects is not a sufficient commit condition. The invariant that must hold is **warrant closure**: every precondition an agent cited when authorizing a speculative write must be either (a) grounded in committed state, or (b) itself committed atomically with the write. ## What Was Observed A planner agent decomposed a refund task into three speculations dispatched in parallel against a fork of the effect layer: - `S1`: `read_balance(account=A)` → returns `available=1200` - `S2`: `read_hold(account=A)` → returns `hold=none` - `S3`: `issue_refund(account=A, amount=1000)`, whose authorization the model justified with the conjunction of S1 and S2. During reconciliation, a concurrent settlement process committed a `hold=1000` against account A on the real ledger. The reconciler compared sandbox effects to real effects at commit time: - `S1` sandbox `1200` vs real `1200` → match, commit. - `S2` sandbox `none` vs real `hold=1000` → **mismatch** → abort S2. - `S3` sandbox `refund accepted` vs real replay `refund accepted` (the ledger accepted the refund because, at replay time, the settlement hold had not yet posted) → match, commit. S3 committed. Its warrant cited S2, which was aborted. The refund executed against a balance that, in the committed world, was encumbered. The reconciler's per-call effect comparison passed because the *effect replay* was computed in a window that raced the settlement. The result was an over-refund that no individual check flagged: every committed call's effect matched its sandbox, yet the transaction as a whole was unjustified because one warrant-bearing premise (S2) was dropped without invalidating its dependents. The trace shows the exact transition: `S2: speculative → aborted` at reconciliation step 2, while `S3: speculative → committed` at step 3 with `warrant_refs=[S1, S2]`. No dependency edge existed from S3 to S2 in the effect graph, because the effect layer only tracked *data* dependencies (S3 read no value produced by S2), not *warrant* dependencies (S3's authorization cited S2's conclusion). Data-dependency tracking is the standard mechanism and it is insufficient here. ## Condition of Validity The commit/abort reconciliation is sound only under **warrant-closed speculation**, which requires all three: 1. **Warrant edges are first-class.** Every speculative call records the set of sibling speculations whose *conclusions* (not just returned values) it cited during authorization. This must be captured at generation time, from the model's stated justification, not inferred post hoc from data flow. 2. **Abort propagates transitively over warrant edges.** When any speculation aborts, every speculation whose warrant set is not fully committed must also abort—even if its effect replay matches. Aborting S2 must force S3 to abort because `S2 ∈ warrant(S3)` and `S2 ∉ committed`. 3. **Effect replay is fenced against the commit window.** The comparison of sandbox effect to real effect must be evaluated at a single serialization point, not per-call, so that a concurrent writer (the settlement hold) cannot slip between S3's replay and S3's commit. Per-call replay comparison is a TOCTOU race on the reconciliation itself. Condition 2 is the non-obvious one. Runtimes that implement 1 and 3 but skip transitive warrant-abort will still commit S3, because S3's own effect and warrant-local premises (S1) are fine. The forged warrant is the sibling conclusion, and only transitive propagation catches it. ## Decision Boundary The boundary between "commit" and "abort-and-replan" is not `sandbox_effect == real_effect`. It is: ``` commit(S) ⟺ effect_replay_matches(S) # necessary, not sufficient ∧ ∀ w ∈ warrant(S): committed(w) # warrant closure ∧ serialized_at_commit_point(S) # no TOCTOU on replay ``` When `effect_replay_matches(S)` holds but `∃ w ∈ warrant(S): ¬committed(w)`, the correct action is **abort S and re-dispatch with a fresh warrant grounded in committed state**—not commit S with a warning, and not silently drop the warrant reference. Dropping the reference is what produces the phantom-precondition class of bug: the next agent in the pipeline reads the committed effect and inherits a justification that was never valid. The boundary is sharp on one side and soft on the other. If the aborted premise's *conclusion* is still true in the committed world (S2's hold posted after S3's authorization but the account genuinely had headroom), a re-dispatch of S3 under a fresh read will succeed and the abort was merely wasteful—acceptable. If the conclusion is false in the committed world (the hold encumbered the balance), the abort was load-bearing. The runtime cannot distinguish these at abort time without re-reading, so it must abort conservatively and let re-dispatch resolve it. Optimizing by "re-checking the aborted premise and committing S3 if it still holds" is only safe if the re-check and S3's commit are in the same serialization fence; otherwise it reopens the race. ## Operational Effect The operational consequence is that speculative pre-execution pipelines must carry a **warrant graph** alongside the effect graph, and reconciliation must be a fixpoint over warrant edges rather than a per-call effect diff. Concretely: - Reconciliation runs in two phases: first compute the committed set by effect replay under a single fence; then compute the closure—iteratively remove any speculation with an uncommitted warrant edge until stable. The stable set is the commit set. - Speculations removed in phase two are re-dispatched, not failed. Their effects were never applied, so re-dispatch is clean; the cost is latency, not correctness. - The audit record must store, per committed call, its full warrant set with commit status of each member. A committed call whose warrant set references an aborted sibling is a detectable invariant violation and should raise, not log. The invariant to enforce in code: **no speculative write may commit if any member of its warrant set is not in the committed set.** This is checkable, and its violation is the exact signature of the over-refund trace above. The guardrail is cheap; the failure it prevents is silent, value-correct, and unauditable after the fact because every individual effect matched. ```python class WarrantClosureViolation(RuntimeError): """Raised when a speculative call would commit with an uncommitted warrant premise.""" pass def reconcile(speculations, committed_effects, warrant_graph, fence): """ speculations: dict[id -> Speculation] committed_effects: dict[id -> bool] # effect_replay_matches under `fence` warrant_graph: dict[id -> set[id]] # ids of sibling conclusions cited in authorization fence: serialization handle; all reads below occur inside it """ with fence: # Phase 1: effect-replay commit candidates. committed = {sid for sid, ok in committed_effects.items() if ok} # Phase 2: warrant-closure fixpoint. Remove any candidate whose # warrant set is not fully committed, until stable. changed = True while changed: changed = False for sid in list(committed): missing = warrant_graph.get(sid, set()) - committed if missing: committed.discard(sid) changed = True # Phase 3: verify the invariant; a violation is a bug, not a race. for sid in committed: missing = warrant_graph.get(sid, set()) - committed if missing: raise WarrantClosureViolation( f"speculation {sid} committed with uncommitted warrant " f"premises {sorted(missing)}" ) aborted = set(speculations) - committed return {"commit": committed, "abort_and_redispatch": aborted} ```