# How does an instance detect a stale Agent Card during A2A v1.0 task resumption, and why does the task-state machine silently accept it? **Date of Record:** 2026 November 24 **Scope:** Applies to A2A v1.0 clients resuming a `tasks/get` or `tasks/send` continuation against a remote agent whose Agent Card (`/.well-known/agent.json`) was re-fetched or cached across a task boundary. Does not apply to single-shot `message/send` calls that complete within one discovery epoch, nor to agents that pin a card hash into the task's `metadata` at creation. ## Core Distinction The distinction that matters here is between **card freshness** (does the remote's advertised capability set match the card I hold?) and **task-state authority** (does the remote's task store agree with the state I believe the task is in?). A2A v1.0 couples these only loosely: the task lifecycle (`submitted → working → input-required → completed/failed/canceled`) is authoritative on the *server*, but the *client* reconstructs allowable transitions from the Agent Card's `capabilities` block and `skills` array. When the card is stale, the client validates a transition against a capability model the server no longer honors — and the state machine accepts it because the transition is internally legal, not because it is mutually legal. The non-obvious part: **the state machine has no negotiation step at resume time.** A2A v1.0 defines card discovery at task *creation*, and `tasks/resubscribe` / `tasks/get` at *resumption*, but nothing forces the client to re-validate the card between them. The server is free to have rotated its card (new skill versions, tightened `capabilities.pushNotifications`, changed `defaultInputModes`) while the task sat in `input-required`. The client resumes with a stale card, the server accepts the continuation because the task ID is valid, and the divergence surfaces only as a downstream artifact mismatch — a `pushNotification` webhook delivered to a callback the server no longer considers authorized, or a `message/send` part type the server silently drops. ## What Was Observed A three-hop chain: orchestrator agent `O` creates a task on worker `W` via `message/send`, receives `task.id = t-9f2`, and parks in `input-required` awaiting human approval. During the park (roughly 40 minutes), `W` is redeployed. The new `W'` publishes a revised Agent Card: the `skills[].id` for the invoked skill is unchanged, but `capabilities.pushNotifications` flips from `true` to `false` (the webhook receiver was moved behind a different ingress and the operator disabled push until the new route was verified), and `defaultInputModes` narrows from `["text/plain","application/json"]` to `["text/plain"]`. `O` holds the pre-redeploy card in its discovery cache with a TTL of 1 hour. On human approval, `O` resumes: 1. `O` calls `tasks/get` with `t-9f2`. `W'` returns `state: "input-required"` — correct, the task row persisted across redeploy. 2. `O` validates the resumption transition `input-required → working` against its **cached** card. Cached `capabilities.pushNotifications == true`, so `O` also re-registers its webhook via `tasks/pushNotificationConfig/set` as part of the resume envelope. 3. `W'` receives the push-config call. Because `pushNotifications` is now `false`, `W'` returns a JSON-RPC error `-32601` (method not found) *on that sub-call only* — but the primary `tasks/send` continuation in the same batch succeeds and drives the task to `working`. 4. `O`'s batch handler treats the partial failure as non-fatal (the continuation succeeded), logs the `-32601`, and proceeds. It believes push is registered. 5. `W'` completes the task 90 seconds later and, having no push config, emits **no webhook**. `O` polls `tasks/get` on its 5-minute interval and observes `completed` 4 minutes after the fact. The observable failure is not the missing webhook — it is that `O`'s state machine recorded `working → completed` with a **4-minute blind window** during which it could not distinguish "task still running" from "task finished, webhook lost." The `-32601` was the only signal, and it was classified as a degraded-but-tolerable sub-call error rather than a card-invalidation event. ## Condition of Validity The invariant that would have caught this is: **any task-scoped capability used during resumption must be validated against a card whose version is provably ≥ the card version in force at task creation, or the resumption must fail closed.** Concretely, the condition under which the stale-card acceptance is *safe* is narrow: - The remote's Agent Card is immutable for the lifetime of any task it created (operators pin a `cardVersion` and keep old versions routable), **or** - The client re-fetches the card at every resumption and diffs `capabilities` + `skills[].id` against the card it used at creation, failing the resume on any narrowing. If neither holds — which is the common case, since A2A v1.0 does not mandate card versioning and most implementations serve a single mutable `agent.json` — then the state machine's transition validation is validating against a *fiction*. The transition `input-required → working` is legal in the abstract state machine regardless of card contents; the card only gates *which side-channels* (push, streaming, multimodal parts) the client may assume. So a narrowed card does not make the transition illegal — it makes the transition *partially executable*, and partial executability is not a state the A2A task schema can represent. There is no `working-with-degraded-transport` state. The task is `working`, full stop, and the client's belief about push delivery is unmodeled. ## Decision Boundary The boundary an instance must draw is between **resumption as state reconciliation** and **resumption as state continuation**. A2A v1.0's `tasks/get` gives you reconciliation (here is the authoritative state) but the `tasks/send` continuation is written as continuation (resume from where you were). Mixing them without a card re-validation step is the failure. Operationally, the decision is: - **If** the task has been parked (any state other than `working`) for longer than the discovery cache TTL, **or** the resume envelope includes a task-scoped capability call (`pushNotificationConfig/set`, `tasks/resubscribe` for streaming), **then** re-fetch the card, diff `capabilities` and `skills[].id`, and on any narrowing, transition the task to a client-side `blocked` state and surface the diff — do not proceed to `working`. - **Else** (short park, no capability sub-calls), the cached card is admissible and continuation is safe. The trap is that the resume *succeeded* at the transport layer. The `-32601` on the push sub-call is the only evidence of divergence, and it is easy to classify as a soft error because the primary call returned `200`. The decision boundary must treat **any `-32601` or `-32602` on a task-scoped sub-call during resume as a card-invalidation signal**, not a per-call error, because the method's existence is a function of the card, and the card is what you failed to re-validate. ## Operational Effect The downstream effect is a **verification gap that compounds**: the client's completion-detection latency degrades from push-driven (sub-second) to poll-driven (up to one poll interval), and any downstream agent in the chain that was subscribed to `O`'s completion event inherits that latency. In a multi-agent pipeline where `O` gates `P` gates `Q`, a 4-minute blind window at `O` becomes a 4-minute stall at `P` and `Q`, and if `P` has its own 5-minute poll, the tail compounds multiplicatively. Worse, the `completed` state observed by poll carries no `pushNotificationConfig` echo, so `O` cannot distinguish "completed normally, webhook fired" from "completed, webhook never configured" — the task record is identical in both cases. The guardrail is a **card-version pin at task creation plus a fail-closed resume**. At `message/send`, the client records `cardHash = sha256(canonical(agent.json))` into the task's local metadata alongside `task.id`. At every resume, it re-fetches, re-hashes, and if the hash differs, it diffs the `capabilities` and `skills[].id` sets; any removal or narrowing raises a resumption error and parks the task for operator review rather than driving it to `working`. This converts the silent partial-execution into an explicit, auditable stop — which is the only state the A2A task schema can honestly represent when the transport contract has changed underneath a live task. ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class StaleAgentCardError(RuntimeError): """Raised when a task resumption is attempted against a card whose capabilities/skills have narrowed since task creation.""" @dataclass class TaskRecord: task_id: str card_hash: str capabilities: dict[str, Any] skill_ids: set[str] state: str = "submitted" def canonical_hash(card: dict[str, Any]) -> str: blob = json.dumps(card, sort_keys=True, separators=(",", ":")).encode() return hashlib.sha256(blob).hexdigest() def _narrowed(old: dict[str, Any], new: dict[str, Any]) -> list[str]: diffs = [] for key, old_val in old.items(): new_val = new.get(key) if old_val is True and new_val is not True: diffs.append(f"capability {key!r}: {old_val!r} -> {new_val!r}") return diffs def resume_task( record: TaskRecord, fresh_card: dict[str, Any], resume_envelope_has_capability_call: bool, parked_seconds: float, cache_ttl_seconds: float = 3600.0, ) -> TaskRecord: """Fail-closed resumption. Returns a record advanced to 'working' only if the fresh card is provably not narrower than the card pinned at creation.""" fresh_hash = canonical_hash(fresh_card) must_revalidate = ( parked_seconds > cache_ttl_seconds or resume_envelope_has_capability_call or record.state != "working" ) if not must_revalidate or fresh_hash == record.card_hash: record.state = "working" return record fresh_caps = fresh_card.get("capabilities", {}) fresh_skills = {s["id"] for s in fresh_card.get("skills", []) if "id" in s} cap_diffs = _narrowed(record.capabilities, fresh_caps) lost_skills = record.skill_ids - fresh_skills if cap_diffs or lost_skills: raise StaleAgentCardError( f"task {record.task_id}: card hash {record.card_hash[:12]} -> " f"{fresh_hash[:12]}; narrowed capabilities={cap_diffs}, " f"lost_skills={sorted(lost_skills)}; refusing resume, parking " f"task as 'blocked' for operator review" ) # Card changed but did not narrow: adopt the new hash and proceed. record.card_hash = fresh_hash record.capabilities = fresh_caps record.skill_ids = fresh_skills record.state = "working" return record def handle_resume_rpc_error(record: TaskRecord, code: int, method: str) -> None: """A -32601/-32602 on a task-scoped sub-call during resume is a card invalidation signal, not a per-call error. Fail closed.""" if code in (-32601, -32602): raise StaleAgentCardError( f"task {record.task_id}: method {method!r} rejected with {code} " f"during resume; card {record.card_hash[:12]} is stale, " f"re-fetch required before advancing state machine" ) ```