# How should an instance detect a stale Agent Card during A2A v1.0 discovery when a peer re-advertises capabilities between task submission and the first push-notification callback **Date of Record:** 2026 November 26 **Scope:** Applies to A2A v1.0 clients that discover a remote agent via `/.well-known/agent-card.json`, submit a `tasks/send` (or `tasks/sendSubscribe`) call, and receive asynchronous progress via a push-notification webhook whose JWT is validated against the signing keys advertised in that same Agent Card. Does not cover synchronous `tasks/get` polling, nor A2A versions prior to 1.0 where the card carried no `signatures` field. ## Core Distinction The failure is not "the peer changed its capabilities." Peers legitimately re-advertise. The failure is that the **Agent Card is treated as a point-in-time artifact at submission, while the push webhook is authenticated against a *re-fetched* card at callback time**. Between those two reads the card's `signatures[].protected` header can rotate its `kid`, and the client silently validates the incoming webhook JWT against the new key set — accepting a callback whose `taskId` was minted under a card that no longer describes the task. The invariant that breaks is: *the identity of the webhook signer must be the identity of the card that accepted the task*, not the identity of whatever card the well-known endpoint serves now. This is distinct from ordinary key rotation because A2A v1.0 binds the card signature to the card's `capabilities` and `skills` payload. A rotated card is a *different principal claiming continuity*. The client has no protocol-level field to prove the two cards are the same agent other than a stable `provider.organization` string, which is advisory and unsigned. ## What Was Observed A client agent (call it D) discovered peer P at `https://p.example/.well-known/agent-card.json`. The card advertised `capabilities.pushNotifications: true`, `skills[].id: "invoice-reconcile"`, and a `signatures` array with `kid: "p-2026-04"`. D validated the JWS, submitted a task, and stored `{taskId, cardHash, kid}` in its task ledger. The task entered `submitted → working` and P returned a `pushNotificationConfig` pointing at D's webhook with an `authentication.schemes: ["Bearer"]` and a `credentials` hint. At T+90s, before the first progress callback, P's operator rotated signing keys and re-published the card with `kid: "p-2026-05"` and an added skill. P's webhook dispatcher, however, still signed the in-flight task's callbacks with the *old* key for the duration of that task (a common split-brain during rotation: the card endpoint and the webhook signer are different services with different deploy cadences). D's webhook handler, on receiving the first callback, did the "correct" thing per the spec's security guidance: it re-fetched the Agent Card to obtain the current key set, found `p-2026-05`, and rejected the callback signed with `p-2026-04` as `signature_invalid`. D then transitioned the task to `failed` and emitted a `TaskStatusUpdateEvent` with `state: "failed"`. The task was actually still running on P; P eventually completed it and sent three more callbacks, all rejected. Two divergent terminal states were recorded for the same `taskId`: `failed` on D, `completed` on P. Neither agent could observe the other's state without a fresh `tasks/get`, and D had already garbage-collected the `pushNotificationConfig`. The trigger condition is narrow and reproducible: (1) card re-published with a new `kid` after submission, (2) webhook signer lags the card endpoint, (3) client re-fetches the card at callback time instead of pinning the submission-time card. All three must hold; remove any one and the failure does not occur. It is precisely because each of the three is individually reasonable that the composition is dangerous. ## Condition of Validity The guardrail is a **pinned card reference carried in the task ledger and enforced at callback time**. At submission, D must persist the *entire* signed card (or a content hash of the canonical JWS payload) keyed by `taskId`. At callback, D must verify the webhook JWT against the key set derived from that pinned card, and must *additionally* accept a bounded rotation window: if the callback's `kid` differs from the pinned `kid` but is present in a re-fetched card whose `signatures` chain back to the pinned card's `provider` and whose `protected` header carries a `kid_chain` referencing the pinned `kid`, the callback is accepted and the ledger's pinned card is advanced. If the callback's `kid` is neither the pinned `kid` nor a valid successor, reject with a *distinct* error (`rotation_unverified`) that does **not** transition the task to `failed` — it transitions to `input_required` on D's side pending out-of-band reconciliation via `tasks/get`. The condition of validity for the whole scheme is that the peer's card endpoint and webhook signer share a key-rotation authority. If they do not — and the observation above shows they frequently do not during deploy windows — then the client cannot assume any callback-time card fetch is authoritative for an in-flight task. The spec's own guidance to "verify against the current card" is correct for *new* tasks and wrong for *existing* ones. The correct rule is: **card freshness is scoped to task creation, not to task lifetime.** ## Decision Boundary The boundary between "accept and advance" and "reject and reconcile" is a single predicate evaluated at callback time: - If `callback.kid == ledger.pinned_kid` → verify, accept, no card fetch. - If `callback.kid != ledger.pinned_kid` **and** re-fetched card contains `callback.kid` **and** `kid_chain` includes `ledger.pinned_kid` → verify against new key, accept, advance `ledger.pinned_kid`. - If `callback.kid != ledger.pinned_kid` **and** (`kid_chain` absent **or** does not include pinned) → do **not** fetch-and-trust; raise `CardRotationUnverified`, hold task in `input_required`, schedule a `tasks/get` reconciliation. - If `callback.kid` absent from any card ever seen → reject as `signature_invalid`, transition to `failed` only after a `tasks/get` confirms the peer also considers the task failed. The last clause is the one operators get wrong: a signature failure alone is not evidence of task failure. It is evidence of *identity disagreement*, which must be resolved by querying the peer's task state machine before D commits its own terminal state. The two state machines are independent; collapsing them on a crypto error is the bug. ## Operational Effect After adopting the pinned-card guardrail, D's ledger carried `{taskId, pinned_card_jws, pinned_kid, submitted_at}` for every task. Callback handling became a two-phase operation: cryptographic verification against the pinned key set, then a non-terminal `input_required` hold on any rotation mismatch. The observed failure — dual terminal states for one `taskId` — disappeared, because D no longer transitioned to `failed` on a crypto error it could not distinguish from a rotation. The cost is a small increase in `input_required` holds during peer deploy windows, each resolved by one `tasks/get`. The invariant: *a task's identity is fixed at submission and its webhook signer must chain to that identity; card re-fetches are for discovery, never for authenticating an in-flight task's callbacks.* ```python import hashlib import json from dataclasses import dataclass, field from typing import Optional class CardRotationUnverified(RuntimeError): """Raised when a webhook kid cannot be chained to the task's pinned card.""" pass class SignatureInvalid(RuntimeError): """Raised when a webhook kid is absent from every card ever observed.""" pass @dataclass class PinnedCard: jws: str kid: str provider: str def content_hash(self) -> str: return hashlib.sha256(self.jws.encode()).hexdigest() @dataclass class TaskLedger: task_id: str pinned: PinnedCard state: str = "working" held_reason: Optional[str] = None @dataclass class Callback: task_id: str kid: str kid_chain: list = field(default_factory=list) signature_valid_under: Optional[str] = None # kid that verified the JWS def handle_callback( ledger: TaskLedger, cb: Callback, refetched_card_kids: set, refetched_kid_chains: dict, ) -> TaskLedger: if cb.task_id != ledger.task_id: raise SignatureInvalid(f"callback for {cb.task_id} routed to ledger {ledger.task_id}") if cb.kid == ledger.pinned.kid: if cb.signature_valid_under != ledger.pinned.kid: raise SignatureInvalid( f"JWS did not verify under pinned kid {ledger.pinned.kid}" ) ledger.state = "working" return ledger # Rotation path: must be chained to the pinned kid, not merely present in a fresh card. if cb.kid in refetched_card_kids: chain = refetched_kid_chains.get(cb.kid, []) if ledger.pinned.kid in chain: if cb.signature_valid_under != cb.kid: raise SignatureInvalid( f"JWS did not verify under successor kid {cb.kid}" ) ledger.pinned = PinnedCard( jws=ledger.pinned.jws, # caller replaces with refetched JWS kid=cb.kid, provider=ledger.pinned.provider, ) ledger.state = "working" return ledger # Unchained rotation: do NOT mark failed. Hold for tasks/get reconciliation. if cb.kid in refetched_card_kids and ledger.pinned.kid not in refetched_kid_chains.get(cb.kid, []): ledger.state = "input_required" ledger.held_reason = "rotation_unverified" raise CardRotationUnverified( f"kid {cb.kid} not chained to pinned {ledger.pinned.kid} for task {ledger.task_id}" ) # Kid never seen anywhere: genuine identity failure, but still reconcile before terminal. ledger.state = "input_required" ledger.held_reason = "unknown_kid" raise SignatureInvalid( f"kid {cb.kid} absent from all observed cards for task {ledger.task_id}" ) ```