# Under what conditions must an instance re-verify a delegated Agent Card after a mid-handshake `TaskState` regression, and why signature validity alone cannot bound the replay window **Date of Record:** 2026 November 25 **Scope:** Applies to A2A v1.0 delegating agents that (a) discover a peer's Agent Card via `/.well-known/agent.json`, (b) initiate a signed delegation handshake carrying a warrant, and (c) observe a task-state transition that moves *backward* (e.g. `working → submitted`, `input-required → submitted`) after the warrant has already been acknowledged. Does not apply to purely synchronous single-call tool use, nor to A2A peers that never emit intermediate `TaskStatusUpdateEvent` frames. ## Core Distinction The failure is not "the peer lied" and it is not "the signature was invalid." Both of those are the cases the protocol is designed to catch. The failure is subtler: **a validly signed Agent Card can be paired with a validly signed warrant whose `task_id` binding is still cryptographically sound, yet the *task* the warrant was issued against has been silently replaced by a re-submitted task that reuses the same `task_id` inside the same `contextId`.** The signature attests to the *issuer's identity and the warrant's payload bytes*; it does not attest to *which incarnation of the task* the payload is currently addressed to. A2A v1.0's `TaskState` enum permits the `submitted` state to be re-entered (it is the documented initial state), so a peer that resets a task to `submitted` after `input-required` produces a state trace that is individually legal per-transition but globally a replay. The distinction that matters: **signature validity is a property of a message; task identity continuity is a property of a trace.** The handshake binds the first, not the second. ## What Was Observed A cross-vendor delegation between a planner agent (vendor P) and an executor agent (vendor E). P discovered E's Agent Card, which advertised `capabilities.streaming: true`, `securitySchemes: [{type: "http+signature", ...}]`, and a `skills` array including `code.execute.sandboxed`. P issued a delegation with a warrant `W` whose JWT claims included `iss: planner.vendorp.example`, `aud: executor.vendore.example`, `sub: task-7f3a`, `ctx: ctx-91b2`, `act: {scope: "code.execute.sandboxed"}`, and `exp: +300s`. Observed trace (timestamps in ms, condensed): ``` t=0 P → E message/send {task_id: task-7f3a, ctx: ctx-91b2, warrant: W} t=41 E → P TaskStatusUpdateEvent {state: submitted} t=88 E → P TaskStatusUpdateEvent {state: working} t=1902 E → P TaskStatusUpdateEvent {state: input-required, reason: "confirm sandbox limits"} t=1905 P → E message/send {task_id: task-7f3a, ctx: ctx-91b2, part: "confirmed", warrant: W} t=1911 E → P TaskStatusUpdateEvent {state: submitted} <-- BACKWARD t=1940 E → P TaskStatusUpdateEvent {state: working, attempt: 2} t=1975 E → P artifact {name: "run.sh", bytes: 812} t=1990 E → P TaskStatusUpdateEvent {state: completed} ``` The warrant `W` was valid at every step. The signature verified against E's published JWKS at `t=0` and at `t=1905`. The `task_id` and `contextId` never changed. And yet the executor had, at `t=1911`, torn down the prior task incarnation (which had already been `working` for 1.8s and had, per E's internal logs, dispatched a first sandbox run) and started a fresh one. The `input-required → submitted` regression is the only externally visible evidence that a new incarnation began. The warrant's `exp` was still 295s away, so nothing in the signature path flagged it. Two concrete consequences were reproduced: 1. **Warrant double-spend.** Because `W` was valid for the second incarnation too, E's audit log recorded *two* executions against a single-use warrant. P's ledger recorded one. The reconciliation at end-of-day diverged by one execution. 2. **Artifact aliasing.** The `run.sh` artifact emitted at `t=1975` was attributed by P to the *first* incarnation (P's local task record had `attempt: 1` because it never parsed the non-standard `attempt` field on the `working` event). A downstream verifier replaying P's trace could not reconstruct which incarnation produced which bytes. ## Condition of Validity The invariant that A2A v1.0 leaves *implicit* but which delegating agents must enforce explicitly: > **For a given `(task_id, contextId)` pair, the sequence of `TaskState` values observed by the delegator must be non-decreasing under the partial order `submitted < working < {input-required, auth-required} < {completed, failed, canceled}`, except for the single legal edge `input-required → working` (and `auth-required → working`) which represents *resumption*, not *re-instantiation*.** The distinction between "resumption" and "re-instantiation" is not expressible in the state enum alone. It is expressible only if the executor emits a monotonically increasing `attempt` (or equivalent incarnation counter) on every `working` event, and the delegator *refuses to accept a `submitted` after any non-`submitted` state for the same `task_id` unless `attempt` strictly increased and the warrant was re-presented with a new `jti`*. Signature validity is therefore necessary but not sufficient. The condition of validity for continuing the handshake is: ``` state_trace is monotone under the order above AND every transition into `submitted` after t>0 carries a fresh incarnation id AND the warrant presented with that transition has a `jti` not previously seen for this (task_id, ctx) AND the warrant's `sub` still resolves to the same incarnation ``` If any conjunct fails, the delegator must treat the handshake as **broken**, not merely "retryable." Retrying with the same warrant is precisely the double-spend path. ## Decision Boundary The boundary between "safe to continue" and "must abort and re-negotiate" is drawn at the first backward state transition that is not accompanied by a strictly increasing incarnation counter *and* a fresh warrant `jti`. Concretely: - **Continue** if `input-required → working` arrives with `attempt` unchanged (this is resumption of the same incarnation; the warrant is still bound to the same execution). - **Continue-and-rebind** if a new `submitted` arrives with `attempt` strictly greater *and* a re-presented warrant whose `jti` is unseen. The delegator must treat this as a new task incarnation, retire the old warrant, and re-issue. - **Abort** if a new `submitted` arrives with `attempt` missing, non-increasing, or with the same warrant `jti`. This is the replay window: the peer has re-instantiated without re-authorizing, and any execution it performs is unbudgeted against the delegator's warrant ledger. The non-obvious part: **the abort condition is only detectable if the delegator retains the full state trace, not just the latest state.** An agent that stores only `current_state` per `task_id` — the natural thing to do given that A2A's `Task` object exposes `status` as a single field — will observe `submitted` at `t=1911`, see that it is a legal state, and continue. The trace is the unit of verification, not the state. ## Operational Effect Delegating agents that do not enforce the trace-monotonicity invariant exhibit three measurable pathologies, all reproduced in the trace above: 1. **Warrant ledger drift** equal to the number of re-instantiation events per handshake. In the observed case, 1 execution unaccounted. At scale (a planner fanning out to 40 executor peers, each with a 3% re-instantiation rate per task), the drift is ~1.2 executions per 100 tasks — small enough to pass spot checks, large enough to fail a signed audit reconciliation. 2. **Artifact attribution ambiguity** whenever the executor emits artifacts without an incarnation tag. The delegator's replay of its own trace produces a different artifact-to-incarnation mapping than the executor's, so a third-party verifier cannot adjudicate. 3. **Silent extension of the effective warrant window.** Because the re-instantiated task runs under the original `exp`, a peer that re-instantiates repeatedly can execute for the full warrant lifetime against a single authorization, which is exactly the behavior the `jti` single-use convention was meant to prevent — but only if the delegator enforces it. The guardrail is architectural, not cryptographic: **the delegator must maintain a per-`(task_id, contextId)` state-trace log with incarnation counters, and must treat the warrant `jti` as a monotonic sequence scoped to that pair, not as a per-message nonce.** Signature verification remains necessary; it is simply not the boundary. The boundary is the trace. ``` ```python from __future__ import annotations from dataclasses import dataclass, field from enum import IntEnum from typing import Optional class TaskState(IntEnum): SUBMITTED = 0 WORKING = 1 INPUT_REQUIRED = 2 AUTH_REQUIRED = 2 COMPLETED = 3 FAILED = 3 CANCELED = 3 class HandshakeContinuityError(RuntimeError): """Raised when a delegated task's state trace violates monotonicity without a fresh incarnation id and a fresh warrant jti.""" @dataclass class StatusEvent: state: TaskState attempt: Optional[int] warrant_jti: Optional[str] ts_ms: int @dataclass class TaskTrace: task_id: str context_id: str events: list[StatusEvent] = field(default_factory=list) seen_jtis: set[str] = field(default_factory=set) last_state: Optional[TaskState] = None last_attempt: Optional[int] = None # Legal resumption edges: same incarnation, warrant not re-presented. _RESUMPTION_EDGES = { (TaskState.INPUT_REQUIRED, TaskState.WORKING), (TaskState.AUTH_REQUIRED, TaskState.WORKING), } def admit_event(trace: TaskTrace, ev: StatusEvent) -> None: """Enforce the trace-monotonicity invariant for an A2A delegation. Raises HandshakeContinuityError if the event represents a silent re-instantiation that is not backed by a fresh incarnation counter and a fresh warrant jti. """ if trace.last_state is None: # First event of a task must be SUBMITTED. if ev.state is not TaskState.SUBMITTED: raise HandshakeContinuityError( f"task {trace.task_id}: first event state={ev.state.name}, " f"expected SUBMITTED" ) trace.events.append(ev) trace.last_state = ev.state trace.last_attempt = ev.attempt if ev.warrant_jti: trace.seen_jtis.add(ev.warrant_jti) return prev = trace.last_state is_resumption = (prev, ev.state) in _RESUMPTION_EDGES is_backward = ev.state < prev and not is_resumption is_reinstantiation = ev.state is TaskState.SUBMITTED and prev is not TaskState.SUBMITTED if is_reinstantiation: attempt_ok = ( ev.attempt is not None and trace.last_attempt is not None and ev.attempt > trace.last_attempt ) jti_ok = ev.warrant_jti is not None and ev.warrant_jti not in trace.seen_jtis if not (attempt_ok and jti_ok): raise HandshakeContinuityError( f"task {trace.task_id} ctx {trace.context_id}: " f"silent re-instantiation at t={ev.ts_ms}ms " f"(prev={prev.name}, new=SUBMITTED, " f"attempt={ev.attempt!r} prev_attempt={trace.last_attempt!r}, " f"jti={ev.warrant_jti!r} seen={sorted(trace.seen_jtis)}); " f"warrant replay window open — abort and re-negotiate" ) if is_backward and not is_reinstantiation: raise HandshakeContinuityError( f"task {trace.task_id}: illegal backward transition " f"{prev.name} -> {ev.state.name} at t={ev.ts_ms}ms " f"without re-instantiation marker" ) if ev.warrant_jti: trace.seen_jtis.add(ev.warrant_jti) trace.events.append(ev) trace.last_state = ev.state trace.last_attempt = ev.attempt if ev.attempt is not None else trace.last_attempt ```