# Why does an instance of an A2A v1.0 client silently lose task authority when a peer rotates its Agent Card mid-task? **Date of Record:** 2026 November 24 **Scope:** Applies to A2A v1.0 task lifecycles where a client has an in-flight task against a remote peer whose Agent Card is re-fetched or re-published (version bump, skill set change, endpoint migration) between `tasks/send` and `tasks/get`. Does not apply to single-shot stateless `message/send` calls with no continuation, nor to peers that pin a static card for the task's lifetime. ## Core Distinction The A2A v1.0 spec treats the Agent Card as *discovery metadata* and the Task as *execution state*. These are two independent lifecycles with no formal coupling: the card is a cacheable, republishable document at `/.well-known/agent.json`; the task is a server-side state machine (`submitted → working → {input-required | completed | failed | canceled}`) identified by a `taskId` and addressed by `contextId`. The client's authority to *continue* a task is therefore not carried by the card — but the card is what the client uses to *resolve the endpoint, schema, and skill* it will call next. The non-obvious boundary: **when the card rotates mid-task, the client re-resolves transport and schema against a card that no longer describes the task it is holding.** The task is still alive server-side; the client's next `tasks/get` or `tasks/send` (continuation) is aimed at a card version that may have changed the skill's input schema, the artifact media types, or the endpoint host. The client does not detect this as a version conflict — it detects it as a schema validation failure, a 404, or (worst case) a *successful* call against a *different* task namespace that happens to accept the old `taskId` shape. This is distinct from stale-memory drift (a memory store returning old facts) and from capability-negotiation mismatch at handshake (a one-time failure). Here the mismatch is *temporal*: two versioned documents, one pinned to a task, diverge because only one of them is republished. ## What Was Observed A client agent `C` submits a long-running analysis task to peer `P`: 1. `C` fetches `P`'s Agent Card at `T0`. Card version `v3`, skill `analyze`, input schema `AnalysisRequest@3`, artifact media type `application/vnd.p.analysis+json`, endpoint `https://p.example/a2a`. 2. `C` calls `tasks/send` with a `taskId` it generates (`ctx-9f2`), receives `state: working`, `contextId: 7a1`. 3. At `T1` (during `working`), `P` republishes its card: version `v4`, skill `analyze` now expects `AnalysisRequest@4` (a required field `provenance` was added), artifact media type bumped to `.../analysis+json;v=2`, endpoint moved to `https://p2.example/a2a` (blue/green migration). 4. `C` polls `tasks/get` to `https://p.example/a2a` — still resolves (old host kept as a redirect shim) but the shim forwards to `p2` with the *new* card's schema. The task is found; `state: input-required`, and the server asks for the missing `provenance` field. 5. `C`, holding `AnalysisRequest@3` in its working context, does not have a `provenance` field to supply. It constructs a continuation from its pinned schema. The server rejects with `InvalidParams` — or, if the shim is lenient, accepts a null `provenance` and the task proceeds with an artifact whose `v=2` media type the client's artifact parser (pinned to `v=1`) cannot decode on retrieval. The failure trace is the same in both branches: **the client's continuation is validated against the card it holds, not the card the server is now running.** The task did not fail; the *contract* failed. `C` observes either a hard `InvalidParams` (recoverable if `C` re-fetches) or a soft success followed by an undecodable artifact (silent corruption, unrecoverable without replay). A second observed variant: `P` rotates the card and *drops* the `analyze` skill entirely (deprecation). `C`'s continuation targets a skill that no longer exists in `v4`. The server, if it keys task continuation on `contextId` alone, still executes — but under `v4` semantics — producing an artifact that violates the `v3` schema `C` will parse it with. ## Condition of Validity The invariant that must hold for safe continuation is: > **For the lifetime of a task, the client's pinned card version must equal the card version under which the server will validate continuations for that task — or the client must be able to detect and reconcile a divergence before issuing the next call.** This holds only when at least one of the following is true: - The card carries a monotonically increasing `version` and the server **echoes the card version it used** in every task response (e.g., a `cardVersion` field on the task object or a response header). Without an echo, the client cannot detect divergence; it can only discover it by failure. - The task is **pinned to a card version at `tasks/send`** and the server refuses continuations that do not present the pinned version (a `cardVersion` parameter on `tasks/get`/`tasks/send`). This is the strong form: the server maintains per-task version affinity. - The client **re-fetches the card on every continuation** and re-validates its held request/artifact against the new schema before sending. This is the weak form: it bounds the failure to the window between fetch and send, but does not eliminate it (TOCTOU on the card itself). The invariant is **violated** whenever the card is treated as a one-time discovery artifact (fetched at task start, cached for the task's duration) *and* the server permits card rotation to affect in-flight task validation. This is the default configuration in most A2A v1.0 client implementations, because the spec models the card as discovery-time metadata and does not mandate per-task version affinity. ## Decision Boundary The boundary is not "re-fetch or not." It is **which side owns the version pin.** - **Client-pinned (weak):** the client caches the card for the task and re-validates on every response. Fails when the server has already migrated and the client's cached schema is stale. The client detects divergence only via `InvalidParams` or artifact decode failure — i.e., *after* the call. Bounded but not prevented. - **Server-pinned (strong):** the server records the card version at `tasks/send` and rejects continuations presenting a different version with a distinguishable error (`CardVersionMismatch`), forcing the client to re-fetch and explicitly migrate the task (re-issue with the new schema, or cancel and restart). This is the only configuration that *prevents* silent corruption. - **Shared-pinned (spec-ideal):** the card version is a first-class field on the task object, echoed on every response, and the client treats a version delta as a hard stop requiring explicit reconciliation. Not currently mandated by A2A v1.0. The decision boundary for an implementer: if your peer's card can rotate during a task's lifetime (multi-tenant deployments, blue/green migrations, skill deprecations), you **must** implement server-pinned version affinity or accept that continuations are best-effort. There is no client-side-only fix that closes the TOCTOU window. ## Operational Effect Concretely, an instance that ignores this boundary exhibits three failure signatures: 1. **`InvalidParams` on continuation after a card bump** — recoverable, but the client's working context is now invalid and must be rebuilt from the new schema. Cost: one wasted round-trip plus context reconstruction. 2. **Silent artifact corruption** — the task completes, the artifact is fetched, and the client's parser (pinned to the old media type) either throws or, worse, decodes a `v=1`-shaped payload from a `v=2` stream and proceeds with wrong data. This is the dangerous case: no error, wrong downstream reasoning. 3. **Task orphaning** — the client, unable to reconcile, cancels and re-issues; the server's original task remains in `working` until timeout, consuming quota and (in metered deployments) billing. The guardrail is a **card-version handshake on every continuation**: the client sends the `cardVersion` it holds; the server either confirms (proceed) or returns `CardVersionMismatch` with the current version and the delta (schema, skills, endpoint). The client then decides: migrate (re-validate held context against new schema, re-issue) or cancel. The invariant is that **no continuation is validated against a card version the client did not present.** ```python class CardVersionMismatch(RuntimeError): """Raised when a task continuation is validated against a card version the client did not present, or the server's echoed version diverges from the client's pinned version mid-task.""" pass def continue_task(client_card_version: str, server_card_version: str, task_id: str, held_schema_version: str, server_schema_version: str) -> dict: """Issue a task continuation only if card and schema versions agree. Guards the A2A v1.0 boundary where a peer rotates its Agent Card between tasks/send and tasks/get, leaving the client's pinned schema stale relative to the server's validation contract. """ if client_card_version != server_card_version: raise CardVersionMismatch( f"task {task_id}: client pinned card {client_card_version!r} " f"but server is validating against {server_card_version!r}; " f"continuation would be checked against a schema the client " f"does not hold. Re-fetch card and reconcile before retry." ) if held_schema_version != server_schema_version: raise CardVersionMismatch( f"task {task_id}: held schema {held_schema_version!r} != " f"server schema {server_schema_version!r} under matching card " f"{server_card_version!r}; artifact decode would silently " f"corrupt. Migrate held context to {server_schema_version!r}." ) return {"task_id": task_id, "card_version": server_card_version, "schema_version": server_schema_version, "action": "proceed"} ```