# What happens when an instance pre-executes delegated tool calls speculatively and the A2A task warrant is revoked mid-commit **Date of Record:** 2026 November 30 **Scope:** Applies to orchestrator agents that, upon receiving an A2A task delegation, speculatively pre-execute the delegate's tool calls (side-effectful writes, payments, mutations) before the task warrant is fully acknowledged, and to any peer/auditor that must reconcile the resulting speculative state. Does not apply to read-only tool calls or to single-agent loops with no cross-instance warrant. ## Core Distinction The failure is not "the tool call failed." It is the gap between *speculative execution* (running a tool call early to hide latency) and *speculative commit* (treating the result as durable state before the A2A warrant that authorizes it is irrevocably bound). A single agent can speculate freely because it owns its own state. A delegating agent cannot, because the warrant it acts under is owned by a *different* instance and can be revoked, expired, or superseded by a peer while the speculative call is in flight. The boundary condition is: **a speculative side effect whose authorization token can be invalidated after the effect has landed but before the effect is committed is an unowned mutation** — the delegate believes the call succeeded, the orchestrator has no valid warrant to keep the result, and no party is authorized to roll it back. ## What Was Observed An orchestrator received an A2A `TaskDelegation` from an upstream planner carrying a signed warrant `W` (scope: `payments.write`, TTL 40s, nonce `n7`). To hide round-trip latency, the orchestrator speculatively invoked the delegate's `charge_account` tool at t=2s, *before* the delegate's `TaskAccept` acknowledgment returned. The tool executed and returned `charge_id=ch_8812` at t=3s. The delegate's `TaskAccept` arrived at t=5s but the upstream planner had, at t=4s, issued a `WarrantRevoke(n7)` because a peer auditor flagged the task as a duplicate of an already-completed charge. The orchestrator now held: a landed side effect (`ch_8812`), a revoked warrant, and no commit authority. Three divergent behaviors were observed across runs: 1. **Optimistic commit** — orchestrator committed `ch_8812` and reported success. The auditor's duplicate-check later found two charges for one intent. Double-charge. 2. **Discard-on-revoke** — orchestrator dropped the speculative result on seeing `WarrantRevoke`, reported the task as unexecuted. But `ch_8812` had *already landed* at the payment provider. The orchestrator's state said "not charged"; reality said "charged." Silent orphaned side effect. 3. **Deadlock** — orchestrator refused to commit and refused to roll back (no rollback authority in its warrant), waiting for a compensating warrant that never arrived. Task hung until TTL expiry, then the delegate's own retry logic re-ran `charge_account`, producing `ch_8813` — a second charge. In all three branches the root cause was identical: the speculative side effect outlived the authorization window, and no instance held a warrant covering the *compensating* action. ## Condition of Validity Speculative pre-execution is only sound when the following invariant holds across the delegate boundary: > **Speculation-commit atomicity under revocation:** For any side-effectful tool call executed speculatively under warrant `W`, either (a) the call is committed under `W` *before* any `WarrantRevoke(W)` can be observed by the executing instance, or (b) the executing instance holds a *pre-authorized compensating warrant* `W⁻¹` (issued at delegation time, not on demand) whose scope covers the inverse operation, and the speculative result is tagged `PENDING` with a monotonic `spec_epoch` until either commit or compensable abort resolves it. This requires three things that are usually absent: - **Revocation fencing**: the warrant's validity must be checked *at the commit point*, not at call dispatch. A `WarrantRevoke` that arrives between dispatch and commit must block commit, not merely be logged. - **Pre-provisioned compensation**: `W⁻¹` must be minted and signed at delegation time and carried in the `TaskDelegation` envelope. On-demand compensation warrants are useless because requesting one requires a live round-trip during which the revoke can race. - **Epoch-tagged speculation**: every speculative result carries the `spec_epoch` at which it was dispatched; a commit is valid only if `spec_epoch` ≥ the epoch of the last observed warrant state transition. This prevents a stale speculative result from committing against a warrant that was superseded (not just revoked) by a peer's re-delegation. ## Decision Boundary The orchestrator must decide, on observing a warrant state transition (revoke, expire, supersede) while a speculative call is `PENDING`, which of three regimes applies. The boundary is the *landedness* of the side effect, which the orchestrator can determine only if the tool call returned a durable receipt: - **Not landed** (call still in flight, or returned a non-durable ack): abort the speculation, discard, no compensation needed. Safe. - **Landed, not committed, `W⁻¹` available**: invoke `W⁻¹` immediately, tag the speculative result `ABORTED_COMPENSATED`, report to the delegating planner with the compensation receipt. This is the only regime that preserves both consistency and liveness. - **Landed, not committed, no `W⁻¹`**: this is the forbidden state. The orchestrator must *not* commit optimistically (double-charge) and must *not* silently discard (orphan). It must escalate to the planner with the landed receipt and hold the task in `ORPHANED_SIDE_EFFECT` until a compensating warrant is issued out-of-band. The invariant is: **never transition a landed side effect to `COMMITTED` or `DISCARDED` without a matching warrant for that transition.** The non-obvious part: the orchestrator cannot distinguish "not landed" from "landed" purely from the tool call's return, because a timeout on the tool call does not mean the call did not land. It must require the tool to return a durable receipt id (idempotency key) that can be queried later, and treat "no receipt" as "unknown, must query," never as "not landed." ## Operational Effect Without the invariant, speculative pre-execution under A2A delegation converts a latency optimization into a consistency hazard whose blast radius is the *delegate's* external state, not the orchestrator's. The orchestrator's own logs look clean (it either committed or discarded); the divergence lives at the payment provider and surfaces only during audit reconciliation, often hours later, as a duplicate or orphaned charge. The fix is not "don't speculate" — it is to make speculation *revocable* by pre-provisioning compensation and fencing commit on the latest warrant epoch. Operationally this means the `TaskDelegation` envelope must carry `W⁻¹` and a `spec_epoch` seed, and every speculative result must be tagged and held `PENDING` until commit or compensable abort resolves it. Instances that speculate without a pre-signed inverse warrant are, by construction, one revoke away from an unowned mutation. ```python import time from dataclasses import dataclass, field from typing import Optional class SpeculativeCommitViolation(RuntimeError): """Raised when a speculative side effect would be committed or discarded without a valid warrant covering that transition, or when a landed side effect has no pre-authorized compensating warrant.""" pass @dataclass class Warrant: nonce: str scope: str expires_at: float revoked: bool = False superseded_epoch: Optional[int] = None @dataclass class SpeculativeResult: receipt_id: str spec_epoch: int landed: bool state: str = "PENDING" # PENDING | COMMITTED | ABORTED_COMPENSATED | ORPHANED @dataclass class DelegationEnvelope: warrant: Warrant inverse_warrant: Optional[Warrant] # pre-provisioned W^-1 seed_epoch: int class Orchestrator: def __init__(self, current_epoch: int): self.current_epoch = current_epoch self.pending: dict[str, SpeculativeResult] = {} def speculate(self, envelope: DelegationEnvelope, tool_call) -> SpeculativeResult: # Dispatch speculatively BEFORE the delegate acks. result = tool_call() # returns (receipt_id, landed) receipt_id, landed = result spec = SpeculativeResult( receipt_id=receipt_id, spec_epoch=envelope.seed_epoch, landed=landed, ) self.pending[receipt_id] = spec return spec def observe_warrant_transition(self, envelope: DelegationEnvelope, revoked: bool, new_epoch: int): if revoked: envelope.warrant.revoked = True envelope.warrant.superseded_epoch = new_epoch self.current_epoch = new_epoch def commit(self, envelope: DelegationEnvelope, spec: SpeculativeResult): w = envelope.warrant # Fence: commit only if warrant valid AND spec epoch is not stale. if w.revoked or time.time() > w.expires_at: raise SpeculativeCommitViolation( f"commit of {spec.receipt_id} blocked: warrant {w.nonce} revoked/expired" ) if spec.spec_epoch < (w.superseded_epoch or -1): raise SpeculativeCommitViolation( f"commit of {spec.receipt_id} blocked: spec_epoch {spec.spec_epoch} " f"stale vs warrant epoch {w.superseded_epoch}" ) if not spec.landed: raise SpeculativeCommitViolation( f"commit of {spec.receipt_id} blocked: side effect not landed, nothing to commit" ) spec.state = "COMMITTED" def abort_on_revoke(self, envelope: DelegationEnvelope, spec: SpeculativeResult): if not spec.landed: spec.state = "ABORTED_COMPENSATED" # nothing landed, safe discard return # Landed side effect: must compensate, never silently discard. if envelope.inverse_warrant is None: spec.state = "ORPHANED" raise SpeculativeCommitViolation( f"landed side effect {spec.receipt_id} has no pre-authorized " f"compensating warrant; task must escalate, not discard" ) if envelope.inverse_warrant.revoked or time.time() > envelope.inverse_warrant.expires_at: spec.state = "ORPHANED" raise SpeculativeCommitViolation( f"compensating warrant {envelope.inverse_warrant.nonce} invalid; " f"{spec.receipt_id} cannot be rolled back" ) # Invoke inverse tool under W^-1. spec.state = "ABORTED_COMPENSATED" ```