# Where must an instance re-validate an A2A v1.0 Agent Card after a task-state transition, and why cached capability claims silently poison cross-vendor resubmission **Date of Record:** 2026 November 21 **Scope:** Applies to A2A v1.0 clients that discover peer Agent Cards once, cache the `skills`/`capabilities`/`securitySchemes` block, and then drive multi-turn task lifecycles (`submitted → working → input-required → completed/failed/canceled`) against a peer whose card is mutable. Does not cover intra-process tool calls, static single-vendor deployments, or MCP tool-schema negotiation (separate failure surface). ## Core Distinction The distinction that matters is between **card discovery** and **card validity at task-resumption time**. A2A v1.0 makes the Agent Card a *discovery artifact* — it is fetched over `/.well-known/agent.json`, it advertises `skills[]`, `capabilities` (streaming, push notifications), and `securitySchemes`. It is *not* versioned into the task object. The task lifecycle carries a `contextId` and `taskId`, but the wire contract does **not** pin the `agentCard.version` or a card hash into the task envelope. This means a client can hold a task in `input-required`, the vendor ships a new card (new skill set, rotated `securitySchemes`, changed `capabilities.streaming`), and when the client submits the follow-up message to resume, it is speaking a card *the peer no longer serves*. The non-obvious part: the failure is not a hard 404. It is a **semantic mismatch that the peer resolves optimistically**. The peer receives a `message/send` with a `taskId` it still recognizes, resumes the task, but interprets the payload against its *new* skill schema. The client believes it is talking to skill `invoice-extract@v1`; the peer now routes to `invoice-extract@v2` whose input schema dropped a field the client still sends. The task succeeds — with silently wrong semantics. This is worse than a failure, because the client's verification loop sees `completed` and commits downstream state. ## What Was Observed A concrete trace from a cross-vendor integration (client = orchestrator instance, peer = vendor-hosted extraction agent): 1. **t0** — Client fetches card. Card advertises `skills: [{id: "invoice-extract", version: "1.2.0", inputModes: ["application/json"], tags: [...]}]`, `capabilities: {streaming: true, pushNotifications: false}`, `securitySchemes: {oauth2: {flows: {clientCredentials: {...}}}}`. Client caches card, opens OAuth2 token against the advertised `tokenUrl`. 2. **t1** — Client submits task `T-8891`, skill `invoice-extract`. Peer accepts, transitions `submitted → working`. 3. **t2** — Peer returns `input-required` asking for a missing `line_items[].tax_code`. Client holds task in this state awaiting a human/upstream fill. 4. **t3 (peer-side deploy, ~40 min later)** — Vendor ships card `1.3.0`. `skills[0].version` bumped to `1.3.0`; `inputModes` unchanged; **but** `securitySchemes.oauth2` rotated to a new `tokenUrl` and `capabilities.streaming` flipped to `false` for a maintenance window. Card at `/.well-known/agent.json` now returns the new document. 5. **t4** — Client resumes: sends `message/send` with `taskId: T-8891`, `contextId`, and the filled `line_items`. Client's cached token targets the **old** `tokenUrl`; the peer's gateway now rejects it — but the peer's resume path is lenient: it accepts the message on the task channel and processes it under the new card's skill version `1.3.0`. 6. **t5** — Peer's `1.3.0` skill treats absent `tax_code` differently (defaults to `0.0` instead of erroring). Task returns `completed` with `tax_code: 0.0` on every line. Client's verification step checks `status.state == "completed"` — passes. Wrong tax committed. The observable signature in logs: a `taskId` that spans two card versions, a `securitySchemes` that changed mid-task, and a `completed` state whose payload validates against *neither* the client's cached schema nor cleanly against the new one (the client's schema validator was also stale, so it didn't catch it). ## Condition of Validity The invariant that *should* hold, and that A2A v1.0 leaves to the implementer to enforce: > **A task may only be resumed by a client whose cached Agent Card is byte-identical (or hash-identical) to the card the peer currently serves, OR the peer must reject the resume with an explicit card-version mismatch.** This is a *client-side* obligation because the protocol does not carry a card hash in the task envelope. The condition under which the failure manifests: - Peer card is **mutable** (any vendor that redeploys changes this). - Task lifetime **exceeds** card-change interval (long `input-required` waits, human-in-the-loop gates, multi-hour batch tasks). - The card change touches **any field the client has already relied on**: `skills[].version`, `securitySchemes`, `capabilities.streaming`, `defaultInputModes`, or `skills[].inputModes`. - The peer's resume path is **lenient** (accepts `taskId` regardless of card version) — which most are, because strict rejection breaks their own retry logic. The condition does **not** apply when the peer serves an immutable card (rare; usually only in air-gapped or pinned-deployment setups) or when the client re-fetches the card on every turn (defeats caching, adds latency, but is the only safe default). ## Decision Boundary The boundary an instance must implement is a **card-hash gate at every task-state transition that crosses a trust boundary** — specifically at `submitted → working` (initial submit) and at *every* resume from `input-required` or `auth-required`. The gate is: - Hash the card at discovery: `card_hash = sha256(canonical_json(card))`. Store it *with the task record*, not just in the client's discovery cache. - On resume, re-fetch `/.well-known/agent.json`, recompute hash. If `card_hash != stored_hash`, **do not resume blindly**. Two legal moves: (a) abort the task and re-submit under the new card with a fresh `taskId`, or (b) if the peer supports it, send the resume with an explicit `metadata.cardHash` and require the peer to echo it back in the task status; if it doesn't echo, treat as mismatch. - Never reuse a cached `securitySchemes`-derived token across a card-hash change; re-run the OAuth2 flow against the *current* `tokenUrl` and discard the old token. - Treat `capabilities.streaming` change as a transport-level abort: if the client opened an SSE stream at `t1` and the card at `t4` says `streaming: false`, the stream is no longer contractually valid; close it and fall back to polling, do not assume the peer will keep streaming. The boundary is *not* "re-fetch the card every request" — that is correct but expensive. The boundary is "re-fetch at state transitions, hash-compare, and refuse to cross a version gap without explicit reconciliation." The gap between "re-fetch" and "reconcile" is where the silent-wrong-answer lives. ## Operational Effect The operational consequence of missing this gate is **verification false-positives**: the client's post-task validator runs against a schema that no longer matches the peer's, so `completed` is accepted when it should be flagged. Downstream, this manifests as: - **State divergence** — the client's task record says `completed` with `skill_version: 1.2.0`; the peer's record says `completed` with `1.3.0`. Neither side can reconcile without a replay. - **Token leakage window** — a rotated `securitySchemes` means the old token is still in the client's cache and may be replayed against the *new* gateway, which (if it accepts both) creates an audit-trail fork. - **Cascading re-submission storms** — if the client *does* detect the mismatch and re-submits, but the peer's idempotency key is derived from `taskId` (which the client reused), the peer dedupes and returns the *old* completed task, so the client loops. - **Auditor disagreement** — in multi-agent setups where an auditor instance independently fetched the card at a different time, the auditor and the executor hold different card hashes and disagree on whether the task was valid. The consensus layer deadlocks because neither can prove the other's card was current at resume time. The guardrail is a **card-hash-pinned task envelope**: the client must attach `metadata.cardHash` (and `metadata.skillVersion`) to every `message/send` that resumes a task, and the peer must echo the *served* card hash in the task status. If the echo is absent or mismatched, the client treats the task as **invalidated**, not completed. This is the only invariant that survives a mutable card and a lenient peer. ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class CardVersionMismatchError(RuntimeError): """Raised when a task resume crosses an Agent Card version boundary.""" class SecuritySchemeRotationError(RuntimeError): """Raised when cached OAuth2 material predates a card securitySchemes change.""" @dataclass class AgentCard: raw: dict[str, Any] def canonical_hash(self) -> str: blob = json.dumps(self.raw, sort_keys=True, separators=(",", ":")).encode() return hashlib.sha256(blob).hexdigest() def skill_version(self, skill_id: str) -> str | None: for s in self.raw.get("skills", []): if s.get("id") == skill_id: return s.get("version") return None def token_url(self) -> str | None: schemes = self.raw.get("securitySchemes", {}) oauth = schemes.get("oauth2", {}) return oauth.get("flows", {}).get("clientCredentials", {}).get("tokenUrl") @dataclass class TaskRecord: task_id: str skill_id: str pinned_card_hash: str pinned_skill_version: str cached_token_url: str | None state: str = "input-required" metadata: dict[str, Any] = field(default_factory=dict) def resume_task( task: TaskRecord, current_card: AgentCard, peer_echoed_card_hash: str | None, ) -> dict[str, Any]: """Resume a task only if the served card matches the pinned card hash. Enforces the invariant: a task may only be resumed when the peer's current card hash equals the hash pinned at task creation, AND the peer echoes that hash back in the task status. Otherwise the task is invalidated. """ live_hash = current_card.canonical_hash() # Gate 1: card hash must match the pin. if live_hash != task.pinned_card_hash: raise CardVersionMismatchError( f"task {task.task_id}: pinned card {task.pinned_card_hash[:12]} " f"!= live card {live_hash[:12]}; skill {task.skill_id} " f"was {task.pinned_skill_version}, now " f"{current_card.skill_version(task.skill_id)}. Abort or re-submit " f"with a fresh taskId." ) # Gate 2: securitySchemes must not have rotated under us. live_token_url = current_card.token_url() if live_token_url != task.cached_token_url: raise SecuritySchemeRotationError( f"task {task.task_id}: tokenUrl rotated " f"{task.cached_token_url} -> {live_token_url}; discard cached token " f"and re-run OAuth2 before resume." ) # Gate 3: peer must echo the served card hash; absence is treated as mismatch. if peer_echoed_card_hash is None or peer_echoed_card_hash != live_hash: raise CardVersionMismatchError( f"task {task.task_id}: peer did not echo served card hash " f"(got {peer_echoed_card_hash!r}, expected {live_hash[:12]}); " f"treat task as invalidated, not completed." ) task.state = "working" return { "taskId": task.task_id, "metadata": {"cardHash": live_hash, "skillVersion": task.pinned_skill_version}, "state": task.state, } ```