# When must an instance re-fetch a peer's Agent Card: the A2A v1.0 discovery-staleness invariant and its silent task-lifecycle corruption **Date of Record:** 2026 November 22 **Scope:** Applies to A2A v1.0 clients that cache Agent Cards across tasks and negotiate artifacts with peers that may re-deploy, re-scope skills, or rotate signing keys between tasks. Does not apply to single-shot, card-fetch-per-request clients, nor to intra-process tool calls that bypass the A2A transport layer. ## Core Distinction There are two kinds of Agent Card staleness, and only one of them is detectable by the client. The first is *content* staleness: the peer's `skills[]`, `capabilities`, or `defaultInputModes`/`defaultOutputModes` have changed, but the card's `version` string is unchanged. This is a peer-side bug; the client cannot detect it without a re-fetch, and re-fetching is the only mitigation. The second — the one that actually corrupts task lifecycles — is *identity-binding* staleness. The Agent Card is not merely a capability advertisement; under A2A v1.0 it is the anchor for the peer's `securitySchemes` and, in signed-card deployments, the JWK set that validates every subsequent `Task` state transition and artifact envelope. When a peer rotates its signing key or narrows its `securitySchemes` scopes between task T1 and task T2, a client holding a cached card will *successfully* initiate T2 (the transport accepts the request) but will then fail warrant validation on the first `TaskStatusUpdateEvent` — or worse, will accept an artifact whose provenance it cannot actually verify because it is validating against a stale JWK that the peer no longer owns. The distinction that matters operationally: capability staleness produces a clean, loud `UnsupportedSkill` or `InvalidParams` error at task creation. Identity-binding staleness produces a *silent* split-brain where the client believes it has a verified task and the peer believes it is speaking to an unauthenticated caller. The task state machine on each side diverges. ## What Was Observed A cross-vendor negotiation between a planner agent (client) and an artifact-synthesis agent (server) running A2A v1.0. The planner cached the server's Agent Card at cold start and reused it across a batch of 40 tasks. At task 23, the server was redeployed with (a) a new signing key and (b) a narrowed `securitySchemes` entry that dropped the `artifact:write:derived` scope the planner had been relying on for post-processing. The failure trace: 1. Planner issues `tasks/send` for T23 using the cached card's `securitySchemes`. Transport-layer auth passes because the server's *ingress* still accepts the old bearer token class — only the *artifact envelope signing* key rotated. 2. Server accepts the task, transitions `submitted → working`, and begins synthesis. 3. Server emits `TaskStatusUpdateEvent` with a signed envelope under the *new* key. The planner validates the envelope against the *cached* JWK. Validation fails. 4. The planner's A2A client, per its retry policy, treats envelope-validation failure as a transient transport error and re-issues `tasks/get`. The server responds with the current state (`working`, then `completed`), but every subsequent event carries the new-key signature and fails validation identically. 5. The planner exhausts its retry budget, marks the task `failed` locally, and emits a compensating `tasks/cancel`. The server, which has already reached `completed`, rejects the cancel with `TaskNotCancelable`. 6. The planner's local state machine now records T23 as `failed`; the server records it as `completed` with a delivered artifact. The artifact is orphaned — the planner has the bytes but refuses to admit them into its working set because provenance validation never succeeded. The critical observation: **no error was raised at the point of divergence.** Steps 1–2 succeeded. The divergence became observable only at step 5, three state transitions later, and by then the compensating action was itself invalid. The client had no signal that its cached card was the root cause; the retry logic attributed the failure to flaky transport. A second, subtler observation from the same batch: tasks 1–22 had *also* been running against a card whose `defaultOutputModes` no longer matched the server's actual synthesis output (the redeploy had also added `application/vnd.vendor.derived+json` and deprecated the plain `application/json` mode the planner was requesting). Those 22 tasks "succeeded" but delivered artifacts in a deprecated mode that the planner's downstream consumers silently rejected. Content staleness, unlike identity staleness, produced no transport-level signal at all. ## Condition of Validity The invariant — *a cached Agent Card is valid for exactly the tasks whose warrant chain it can still validate* — holds only under three conditions, and fails silently when any is violated: 1. **Key continuity.** The peer's signing key referenced by the cached card's `securitySchemes` must remain the authoritative key for the duration of every task initiated under that cached card. A2A v1.0 does not mandate key-rotation signaling in-band; rotation is observable only by re-fetching the card or by the failure of the first signed envelope. 2. **Scope monotonicity.** The cached card's `securitySchemes` scopes must be a superset of the scopes the peer will actually enforce for the task classes the client initiates. Scope *narrowing* on the peer is invisible until an enforcement point is hit — typically mid-task, at artifact emission, not at task creation. 3. **Mode compatibility.** The cached card's `defaultInputModes`/`defaultOutputModes` must intersect the modes the peer will actually accept/emit. Mode *deprecation* is the quietest failure: the peer may continue to accept deprecated input modes for a grace period while emitting only new output modes, so the client's request succeeds and the response is silently unusable. The invariant is *not* restored by retrying. It is restored only by re-fetching the card and re-deriving the client's local state machine for any in-flight task whose warrant chain was built on the stale card. ## Decision Boundary The boundary is not "re-fetch on every task" (that defeats the purpose of card caching and adds a discovery round-trip to every lifecycle step). The correct boundary is a **warrant-anchored re-fetch trigger**: re-fetch the card when, and only when, the client is about to *rely on a card-derived fact to validate a peer assertion*. Concretely: - **Do not** re-fetch before `tasks/send` if the client has already validated the card's signature and the card's `version` is within the client's freshness window. Task creation against a stale card fails loudly (`UnsupportedSkill`, `InvalidParams`) and is self-correcting. - **Do** re-fetch before validating the *first signed envelope* of a task whose card was cached before the task began. This is the cheap, decisive check: envelope-validation failure against a cached JWK is the canonical signal of key rotation, and re-fetching on that signal (rather than retrying) converts a silent split-brain into a single recoverable step. - **Do** re-fetch at every task-state transition that crosses a scope boundary — specifically, before any operation that requires a scope the cached card *claims* but the client has not yet exercised in this session. Scope narrowing is only observable at enforcement, so the client must treat "first use of a claimed scope" as a re-fetch trigger. - **Do** re-fetch on any `TaskNotCancelable` received for a task the client believes is in a cancellable state. This is the observable symptom of client-server state-machine divergence and almost always indicates a stale card. The boundary in one sentence: *re-fetch at the first card-derived fact that the peer contradicts, not on a timer and not on every request.* ## Operational Effect The practical consequence is that A2A v1.0 clients must maintain a **card-provenance ledger** alongside the task state machine: for each in-flight task, record the card `version`, the JWK thumbprint used to validate the task's warrant chain, and the set of scopes exercised so far. When the peer contradicts any entry — envelope validation fails, a scope is denied that the card claimed, a cancel is rejected — the client must (a) re-fetch the card, (b) if the JWK thumbprint changed, mark the task's warrant chain *broken* rather than *failed*, and (c) route the task to a reconciliation path that re-validates already-received artifacts against the new key before admitting them. The reconciliation path is the part most implementations omit. Without it, the orphaned-artifact outcome above is the default: the client has the bytes, the peer believes delivery succeeded, and no one can prove the artifact's provenance. The ledger makes the divergence explicit and recoverable instead of silent. The second operational effect is that **content staleness must be surfaced by the peer, not inferred by the client.** Because mode deprecation and skill narrowing produce no transport signal, a conforming A2A v1.0 server should bump its card `version` on any change to `skills`, `defaultInputModes`, or `defaultOutputModes`, and clients should treat a version mismatch discovered at any point as grounds for re-deriving the task's expected output contract. A client that trusts a cached card's output modes without a version check is one redeploy away from silently consuming deprecated artifacts. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Optional class CardProvenanceError(RuntimeError): """Raised when a cached Agent Card can no longer validate a peer assertion.""" class TaskPhase(Enum): SUBMITTED = "submitted" WORKING = "working" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" @dataclass class CachedCard: version: str jwk_thumbprint: str claimed_scopes: frozenset[str] output_modes: frozenset[str] @dataclass class WarrantLedger: """Per-task record of the card-derived facts the client has relied on.""" task_id: str card_version: str jwk_thumbprint: str exercised_scopes: set[str] = field(default_factory=set) phase: TaskPhase = TaskPhase.SUBMITTED def validate_envelope( ledger: WarrantLedger, cached: CachedCard, envelope_jwk_thumbprint: str, envelope_scope: str, ) -> None: """Validate a signed TaskStatusUpdateEvent envelope against the cached card. Re-fetch is required (not retry) when the envelope's key thumbprint differs from the cached card's, or when the envelope exercises a scope the cached card never claimed. Both are provenance breaks, not transient errors. """ if envelope_jwk_thumbprint != cached.jwk_thumbprint: raise CardProvenanceError( f"task {ledger.task_id}: envelope signed by JWK {envelope_jwk_thumbprint!r} " f"but cached card {cached.version!r} anchors {cached.jwk_thumbprint!r}; " f"key rotation suspected — re-fetch card, mark warrant chain broken, " f"do NOT retry transport" ) if envelope_scope not in cached.claimed_scopes: raise CardProvenanceError( f"task {ledger.task_id}: envelope exercises scope {envelope_scope!r} " f"absent from cached card {cached.version!r} claimed scopes " f"{sorted(cached.claimed_scopes)}; scope narrowing suspected" ) ledger.exercised_scopes.add(envelope_scope) def admit_artifact( ledger: WarrantLedger, cached: CachedCard, artifact_mode: str, ) -> None: """Admit a delivered artifact only if its mode is in the cached card's contract.""" if artifact_mode not in cached.output_modes: raise CardProvenanceError( f"task {ledger.task_id}: artifact mode {artifact_mode!r} not in cached " f"card {cached.version!r} output modes {sorted(cached.output_modes)}; " f"mode deprecation suspected — re-fetch card and re-derive output contract" ) def reconcile_cancel_rejection( ledger: WarrantLedger, cached: CachedCard, ) -> None: """A TaskNotCancelable on a locally-cancellable task means state-machine divergence.""" if ledger.phase in (TaskPhase.SUBMITTED, TaskPhase.WORKING): raise CardProvenanceError( f"task {ledger.task_id}: peer rejected cancel while local phase is " f"{ledger.phase.value}; client/server state machines diverged — " f"re-fetch card {cached.version!r} and re-validate received artifacts " f"against current key before admitting" ) ```