# In what scenarios must an instance reject a resumed A2A task when the Agent Card's declared `taskState` capability set diverges from the persisted lifecycle checkpoint after a webhook replay **Date of Record:** 2026 November 20 **Scope:** Applies to A2A v1.0 client instances that persist task lifecycle checkpoints and resume them across sessions, where the remote Agent Card is re-fetched (not cached) at resume time, and where push-notification webhooks are signed with the card's declared `securitySchemes`. Does not apply to single-shot synchronous `tasks/send` calls with no checkpoint persistence, nor to instances that pin a card snapshot for the full task lifetime. ## Core Distinction The failure is not "the remote agent changed its behavior." It is that the *client's persisted checkpoint asserts a lifecycle transition the current Agent Card no longer authorizes*. A2A v1.0 Agent Cards declare which `TaskState` values an agent can emit (e.g., `working`, `input-required`, `completed`, `failed`, `canceled`) and which state transitions its task lifecycle supports. The client's checkpoint records a task at, say, `input-required` with a pending continuation. At resume, the card may have been re-published (agent redeployed, capability gated, `input-required` dropped in favor of a stricter `auth-required` variant). The checkpoint is *internally* consistent but *externally* unbacked: it names a state the serving agent will never transition from, because the card no longer lists that state as reachable. The non-obvious part: the webhook signature still verifies. The replay is cryptographically valid. The divergence is in the *state machine*, not the *transport*. An instance that treats "signature valid + task ID present" as "resume is safe" will hang the task forever in a state the peer cannot exit, or worse, replay a continuation into a state the peer has already garbage-collected. ## What Was Observed A client instance persisted a checkpoint at `t0`: task `T-8841`, state `input-required`, `continuationToken` present, `agentCardHash = H1`. The remote agent was redeployed at `t1` with a new card (`agentCardHash = H2`) that dropped `input-required` from `capabilities.taskStates` and added `auth-required`. At `t2` a signed webhook arrived (valid HMAC under the card's `securitySchemes`, key rotated but correctly declared in `H2`), carrying `status.state = "working"` for `T-8841`. The client resumed `T-8841`, posted the stored continuation, and the peer responded `404 task not found` — the redeploy had purged task storage. The client's state machine had no transition from `input-required` to `failed` triggered by `404`, because `H1` had declared `input-required → working | canceled` only. The task sat in `input-required` indefinitely; the client's retry loop re-posted the continuation 14 times over 40 minutes before an operator intervened. Second observation, same class: a replay of an *old* webhook (signed under `H1`'s key, still within the declared `replayWindowSeconds`) arrived after the `H2` cutover. Signature verified against the *archived* `H1` key the client still held. The client applied a `working → completed` transition for a task the `H2` agent had never seen. The client's ledger and the peer's ledger disagreed on terminal state for the same task ID. ## Condition of Validity The invariant that must hold for safe resume is: > A persisted checkpoint at state `S` with card hash `H_persisted` may be resumed only if the *currently served* card `H_current` declares `S` as a reachable state **and** declares every transition the client will attempt from `S`. If `H_current ≠ H_persisted`, the client must re-derive the transition table from `H_current` and validate the checkpoint's `S` against it before issuing any continuation. This is not the same as "verify the card is fresh." A fresh card can still diverge. The condition is specifically about *state-reachability closure*: `S ∈ reachable(H_current)` and `transitions(S, H_current) ⊇ transitions the client intends to take`. Webhook signature validity is orthogonal — it proves the *sender* is the declared agent, not that the *state* is still live. The boundary is sharp: if the card hash matches, resume proceeds under the persisted transition table. If it differs, the client must either (a) re-derive and find `S` reachable, then resume under the new table, or (b) treat the checkpoint as orphaned and transition to a client-local `failed` with reason `card-divergence`, never posting the continuation. ## Decision Boundary The decision is *not* "did the card change?" A cosmetic card change (new `description`, added `defaultInputModes`) does not invalidate a checkpoint. The decision boundary is the set difference: ``` Δ = taskStates(H_persisted) \ taskStates(H_current) ``` If `S ∈ Δ` (the checkpoint's state was removed from the card), the checkpoint is invalid — resume must be refused. If `S ∉ Δ` but `transitions(S, H_current) ⊊ transitions(S, H_persisted)`, the checkpoint is *conditionally* valid: resume is permitted only along the surviving transitions; any continuation that would require a removed transition must be rejected pre-flight. The replay-window edge: a webhook signed under an *archived* key whose `H` has been superseded must be rejected even if the signature verifies, because the key's declaration in `H_persisted` no longer governs the current task lifecycle. The client must bind webhook acceptance to `H_current`'s `securitySchemes`, not to any historically valid key it still holds. ## Operational Effect Without this guard, the observable failure modes are: (1) indefinite hang in a removed state with a retry storm against a peer that has purged the task; (2) ledger divergence where client and peer disagree on terminal state for the same task ID after a stale-key replay; (3) silent continuation injection into a state the peer has already exited, which the peer may accept if it reuses task IDs across redeploys. With the guard, resume either proceeds under a re-derived table or fails fast to a client-local terminal state with an auditable `card-divergence` reason, and webhook acceptance is bound to the current card's key set rather than the union of all keys ever seen. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class CardDivergenceError(RuntimeError): """Raised when a persisted A2A checkpoint cannot be safely resumed against the currently served Agent Card.""" pass @dataclass class AgentCard: card_hash: str task_states: set[str] transitions: dict[str, set[str]] webhook_keys: set[str] # key IDs declared under securitySchemes @dataclass class Checkpoint: task_id: str state: str card_hash: str continuation_token: Optional[str] = None pending_transition: Optional[str] = None def validate_resume(checkpoint: Checkpoint, persisted_card: AgentCard, current_card: AgentCard, webhook_key_id: Optional[str] = None) -> str: """Return the transition table to use for resume, or raise. Invariant: resume is permitted only if the checkpoint's state is reachable under the CURRENT card, and every transition the client intends to take survives the card delta. """ if webhook_key_id is not None and webhook_key_id not in current_card.webhook_keys: raise CardDivergenceError( f"webhook key {webhook_key_id!r} not declared in current card " f"{current_card.card_hash}; stale-key replay refused for task " f"{checkpoint.task_id}" ) removed_states = persisted_card.task_states - current_card.task_states if checkpoint.state in removed_states: raise CardDivergenceError( f"checkpoint state {checkpoint.state!r} for task " f"{checkpoint.task_id} was removed in card " f"{current_card.card_hash}; checkpoint orphaned" ) if checkpoint.pending_transition is not None: persisted_targets = persisted_card.transitions.get(checkpoint.state, set()) current_targets = current_card.transitions.get(checkpoint.state, set()) if checkpoint.pending_transition not in current_targets: raise CardDivergenceError( f"pending transition {checkpoint.state!r} -> " f"{checkpoint.pending_transition!r} for task " f"{checkpoint.task_id} no longer supported by card " f"{current_card.card_hash}" ) # Narrow the table to the surviving intersection. return f"{checkpoint.state}->{checkpoint.pending_transition}" return f"{checkpoint.state} (no pending transition; resume read-only)" ```