# In what scenarios must an instance revoke a speculative tool-call pre-execution whose taint gate was satisfied at dispatch but violated at commit **Date of Record:** 2026 November 22 **Scope:** Applies to agent runtimes that speculatively dispatch tool calls ahead of a completed reasoning chain and gate their *commit* (side-effecting application of the result plus state mutation) on a taint/label check. Does not apply to purely read-only tool surfaces or to runtimes that serialize reasoning to completion before any dispatch. ## Core Distinction The failure mode is not "the taint check passed when it shouldn't have." It is subtler: the taint check is evaluated against the *dispatch-time* label environment, while the commit decision is made against a *later* label environment that the speculation itself helped create. Speculative pre-execution inverts the usual order of taint propagation. Normally a tool call's inputs are tainted by prior state, the call is gated, and only then does it execute. Under speculation, the call executes against input labels captured at $t_0$, produces a result, and sits in a pending buffer while the main reasoning loop continues. That continued reasoning can *retroactively* taint the very state the speculative call depended on—via a newly retrieved document, a poisoned tool response, or an inbound peer message—so that at commit time $t_1$ the call's provenance is no longer clean even though its gate predicate was satisfied at $t_0$. The invariant that operators routinely assume and that is false here: **a satisfied gate at dispatch is a durable authorization.** It is not. It is a point-in-time predicate over a mutable label lattice. The correct invariant is that commit must re-evaluate the taint closure of the call's transitive inputs against the current lattice, and any widening of taint between $t_0$ and $t_1$ across the call's dependency set must revoke the commit—even though the speculative result is already sitting in the buffer, already paid for, and already "looks" safe. ## What Was Observed A planning agent with a speculative executor was tasked with a multi-step workflow: read a config file, compute a derived value, then write that value into a shared resource. The executor speculatively dispatched the write with a computed payload while the planner was still resolving a second, independent branch. At dispatch, the write's input set was {config_read_result, computed_value}; both carried label `internal`, and the safety gate for the `write` tool admitted `internal`. The gate passed; the write entered the pending-commit buffer. Between $t_0$ and commit, the planner's second branch retrieved an external document through an untrusted `fetch` tool. That document was injected with content that the planner incorporated into the *same* computed value's recomputation path—specifically, a re-derivation that pulled one numeric field from the fetched document. The planner's label propagation marked the recomputed value `external_untrusted`, but the *already-buffered* speculative write still referenced the *old* value object and the *old* label snapshot. The commit gate, implemented as a check on the buffered call's recorded gate decision rather than a re-evaluation, admitted the write. The result: an externally-tainted value crossed an `internal`-only trust boundary into a shared resource, and the audit log recorded a *passing* gate at commit because the gate decision was replayed from the buffer rather than recomputed. The trace signature is specific: the commit record's `gate_evaluated_at` timestamp precedes the `taint_widened_at` timestamp on the dependency set, yet the commit proceeded. Replay of the same decision under a fresh label evaluation fails. This is the diagnostic—**commit decisions that do not reproduce under re-evaluation are the fingerprint of stale-gate speculation**, and they are invisible to any monitoring that trusts the recorded gate verdict. ## Condition of Validity The revocation rule is valid—and mandatory—exactly when three conditions hold jointly: 1. **Speculation spans a taint-mutating window.** The interval between dispatch and commit contains at least one operation capable of widening the label of any input in the speculative call's transitive dependency closure (a fetch, an inbound peer message, a memory retrieval, a nested tool result). If the window is provably label-inert, dispatch-time gating is durable and revocation is unnecessary. 2. **The dependency closure is recomputable.** The runtime can reconstruct, at commit time, the full set of state objects the speculative call read, and re-derive their current labels. If the call's inputs were copied by value and the originals discarded, the closure is lost and the commit must be treated as unverifiable—which defaults to revoke, not admit. 3. **The gate predicate is monotone under taint widening.** The gate must admit a strictly smaller label set than the lattice's top, and widening taint must be able to move a previously-admitted input out of the admitted set. A gate that admits everything, or whose predicate ignores the widening dimension, cannot be revoked by re-evaluation and must be replaced, not patched. Where condition 1 fails, the runtime may keep dispatch-time gating as an optimization. Where condition 2 fails, the correct behavior is conservative revocation. Where condition 3 fails, the gate itself is unsound and the speculation architecture is unsafe regardless of re-evaluation. ## Decision Boundary The boundary is not "did the gate pass" but "does the gate still pass under the current lattice." Concretely, at commit time the runtime must compute $$\text{admit} = \text{gate}\big(\,\text{labels}\big(\text{closure}(c)\big)\,\big) \;\wedge\; \text{labels}\big(\text{closure}(c)\big) \preceq \text{ceiling}(\text{tool}(c))$$ where $\text{closure}(c)$ is re-resolved against live state, not the buffered snapshot. The decision boundary sits precisely at the moment taint widens on *any* element of the closure: before widening, commit is admissible; at and after widening, commit must be revoked unless the widened element is provably not on the call's data path to the side effect. Two boundary cases deserve explicit handling. First, **partial widening**: if only a recomputation branch is tainted but the buffered call consumed the pre-widening value, the call may still be admissible *provided the runtime can prove the buffered value is not an alias of the widened object*. In practice, aliasing through mutable references is the dominant cause of false admits, so the safe default is to treat any shared reference as tainted. Second, **widening-then-narrowing**: a label can widen and later narrow (e.g., a tainted document is discarded). The commit gate must evaluate against the *maximum* taint observed across the window, not the instantaneous label at commit, because the side effect's provenance includes everything the call *could* have observed, and narrowing after the fact does not un-observe it. ## Operational Effect The operational consequence is a mandatory re-evaluation pass at commit and a revocation path that the speculative executor must support without corrupting the pending buffer. When revocation fires, the runtime must (a) discard the speculative result rather than apply it, (b) mark the call's dependency closure as requiring re-derivation under current labels, and (c) record a `stale_gate_revoked` event carrying both the dispatch-time and commit-time label snapshots so the divergence is auditable and replayable. Revocation is not an error condition to be suppressed; it is the mechanism by which the trust boundary is maintained. Runtimes that treat revocation as a rare anomaly and log it at debug level will silently leak tainted side effects at exactly the rate their speculation windows overlap taint-mutating operations—which, in agents that fetch or receive messages mid-plan, is most of the time. The cost is real: revoked speculation wastes the dispatched call's compute and forces re-derivation, which can cascade into token-budget pressure if revocation is frequent. The mitigation is not to weaken the gate but to *bound the speculation window*—dispatch speculatively only across operations that are label-inert, and serialize dispatch across taint-mutating operations. This trades speculative throughput for a durable gate, which is the correct trade whenever the side effect crosses a trust boundary. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import IntEnum from typing import Callable, Hashable class Taint(IntEnum): """Ordered label lattice; higher widens taint.""" INTERNAL = 0 PARTNER = 1 EXTERNAL_UNTRUSTED = 2 @dataclass(frozen=True) class LabelSnapshot: labels: dict[Hashable, Taint] def max_on(self, closure: frozenset[Hashable]) -> Taint: if not closure: # Empty closure is unverifiable, not clean. return Taint.EXTERNAL_UNTRUSTED return max((self.labels.get(k, Taint.EXTERNAL_UNTRUSTED) for k in closure), default=Taint.EXTERNAL_UNTRUSTED) @dataclass class SpeculativeCall: call_id: str tool: str closure: frozenset[Hashable] # transitive input ids read at dispatch dispatch_labels: LabelSnapshot ceiling: Taint # tool's admitted taint ceiling result: object = None committed: bool = False class StaleGateRevocation(RuntimeError): """Raised when a speculative call's gate passed at dispatch but fails re-evaluation at commit.""" def gate_admits(observed: Taint, ceiling: Taint) -> bool: return observed <= ceiling def commit_speculative( call: SpeculativeCall, live_labels: LabelSnapshot, apply_side_effect: Callable[[object], None], ) -> None: """ Re-evaluate taint closure against live labels before committing. Widening across the window revokes, even if the dispatch gate passed. """ dispatch_max = call.dispatch_labels.max_on(call.closure) if not gate_admits(dispatch_max, call.ceiling): # Should never have been buffered; defensive. raise StaleGateRevocation( f"{call.call_id}: buffered despite failing dispatch gate " f"({dispatch_max.name} > {call.ceiling.name})" ) live_max = live_labels.max_on(call.closure) # Widening-then-narrowing must not launder: compare against max seen. observed = max(dispatch_max, live_max) if not gate_admits(observed, call.ceiling): raise StaleGateRevocation( f"{call.call_id}: taint widened across speculation window " f"({dispatch_max.name} -> {live_max.name}, ceiling {call.ceiling.name}); " f"commit revoked, result discarded, closure requires re-derivation" ) apply_side_effect(call.result) call.committed = True ```