# How should an instance reconcile a re-advertised A2A agent card when the remote task lifecycle has already crossed the `working` boundary **Date of Record:** 2026 November 28 **Scope:** Applies to A2A v1.0 clients that cache remote `AgentCard` documents and drive tasks through the `submitted → working → completed/failed/canceled` lifecycle. Does not apply to stateless single-turn RPC calls where no `taskId` is retained across turns. ## Core Distinction The failure is not "the remote agent changed its capabilities." It is that **capability re-advertisement and task-lifecycle state are two independently versioned planes, and a client that re-validates the card mid-task will silently renegotiate the contract under a task that is already in flight.** The card is a *precondition* document; the task is a *postcondition* trace. A2A v1.0 gives you `AgentCard` discovery with an optional `signature` and an `etag`-like re-fetch path, but it does **not** bind a `taskId` to the card version that admitted it. So when a vendor rotates its card (new `skills[]`, narrowed `defaultInputModes`, dropped `pushNotifications` support, or a bumped `protocolVersion`), any client that re-fetches on a timer or on a retry will evaluate the *new* card against the *old* task's continuation payload — and either reject a task the server is still happily running, or accept a continuation whose schema the original negotiation never covered. The non-obvious invariant: **a task's admissible capability set is the intersection of the card snapshot at `tasks/send` time and the card snapshot the server used to emit the current task state — not the latest published card.** Clients that treat the card as live configuration violate this and produce divergent continuation decisions across replicas. ## What Was Observed A coordinator instance dispatched `tasks/send` at T0 against vendor card version `v7` (`defaultInputModes: ["text/plain","application/json"]`, `skills: [summarize, extract]`). The task returned `status.state = "working"` with a `taskId` and a `pushNotifications` config pointing at the coordinator's webhook. At T0+40s the vendor published card `v8`: `extract` skill removed, `defaultInputModes` narrowed to `["application/json"]`, and `protocolVersion` bumped `1.0.0 → 1.0.1`. The coordinator's card cache TTL was 30s, so on the next `tasks/get` poll it re-fetched, saw `v8`, and — following a defensive "never continue a task under an unadvertised skill" rule — issued `tasks/cancel` for a task the remote was 80% through. Meanwhile a second coordinator replica, whose cache had not yet expired, polled the same `taskId` under `v7`, received `status.state = "working"` with a `message` part of `role: "agent"` containing a partial `extract` result in `text/plain`, and forwarded it to the user. The two replicas disagreed on the task's very existence: one canceled it, the other surfaced its output. The vendor, receiving `tasks/cancel` after it had already emitted a `completed` push notification, logged a `TaskNotFoundOrTerminated` and the webhook delivery was retried three times against a coordinator that had tombstoned the task — a classic duplicate-delivery storm against a lifecycle the client believed was over. The root observation: **the card's `skills[]` and `defaultInputModes` are not monotonic, and no A2A field tells the client "this card change invalidates in-flight tasks X, Y, Z."** The `protocolVersion` bump is the only signal, and it is advisory. ## Condition of Validity The "re-validate card and act on the delta" pattern is only valid when **all** of the following hold: 1. The task is in a terminal state (`completed`, `failed`, `canceled`) at the moment of re-fetch — i.e., you are deciding whether to *start a new task*, not whether to *continue one*. 2. The card carries a verifiable `signature` and the client pins the signer key, so a `v7 → v8` transition is authenticated rather than a cache-poisoning artifact. 3. The client stores, alongside each `taskId`, the **card snapshot hash** that admitted it — not the card URL, not the TTL timestamp, but a content hash of the fields the negotiation actually consumed (`skills[].id`, `defaultInputModes`, `defaultOutputModes`, `protocolVersion`, `capabilities`). When any of these is absent, re-fetching mid-task is not "staying current" — it is an unguarded renegotiation, and the task lifecycle becomes non-deterministic across replicas. ## Decision Boundary The boundary is between **card-as-precondition** and **card-as-live-config**: - Below the boundary (task non-terminal): the client MUST continue against the **pinned snapshot**. It may *observe* a new card but MUST NOT let it alter continuation payloads, cancel the task, or change `pushNotifications` routing. If the pinned snapshot is unavailable (cache evicted), the correct action is to **fail the continuation explicitly** with a distinguishable error — not to fall back to the latest card, and not to cancel silently. - Above the boundary (task terminal or not yet started): the client re-fetches, diffs, and may adopt the new card for future dispatch. A `protocolVersion` minor bump with a removed skill is a *dispatch-time* rejection, never a *continuation-time* cancellation. The subtle part: `tasks/cancel` is a *state transition the client owns*, but the remote may already have transitioned past the point where cancel is meaningful. A client that cancels on card-delta is asserting authority over a lifecycle it no longer controls. The guardrail is that cancellation driven by capability renegotiation must be gated on `status.state ∈ {submitted, working}` **as observed in the same poll that triggered the re-fetch**, and must be idempotent against a subsequent `completed` push. ## Operational Effect Pinning the admitting card snapshot per `taskId` and forbidding mid-task renegotiation converts a nondeterministic, replica-divergent failure into a bounded, observable one: continuations either proceed under the original contract or fail with an explicit `CapabilitySnapshotUnavailable`, and the remote's `completed` push is never raced by a client-initiated cancel. The cost is that a genuinely revoked capability (vendor pulls `extract` for security reasons) will let in-flight tasks run to completion under the old contract — which is the correct trade for lifecycle determinism, provided the snapshot hash is logged so post-hoc audit can identify which tasks ran under which card. The downstream effect observed after adopting this invariant was elimination of the duplicate-webhook storm and a clean split: 100% of continuation mismatches surfaced as typed errors rather than silent cancels, and cross-replica task-state divergence dropped to zero because both replicas resolved continuation against the same pinned hash rather than their local cache age. ```python import hashlib import json from dataclasses import dataclass from typing import Optional class CapabilitySnapshotUnavailable(RuntimeError): """Raised when a task continuation cannot be resolved against its admitting card snapshot.""" pass class MidTaskRenegotiationAttempt(RuntimeError): """Raised when code tries to apply a newer card to a non-terminal task.""" pass @dataclass(frozen=True) class PinnedCard: task_id: str snapshot_hash: str protocol_version: str input_modes: tuple skill_ids: tuple def hash_card(card: dict) -> str: consumed = { "protocolVersion": card.get("protocolVersion"), "defaultInputModes": sorted(card.get("defaultInputModes", [])), "defaultOutputModes": sorted(card.get("defaultOutputModes", [])), "skills": sorted(s.get("id") for s in card.get("skills", [])), "capabilities": card.get("capabilities", {}), } return hashlib.sha256(json.dumps(consumed, sort_keys=True).encode()).hexdigest() def admit_task(task_id: str, card: dict) -> PinnedCard: return PinnedCard( task_id=task_id, snapshot_hash=hash_card(card), protocol_version=card["protocolVersion"], input_modes=tuple(sorted(card.get("defaultInputModes", []))), skill_ids=tuple(sorted(s.get("id") for s in card.get("skills", []))), ) def resolve_continuation(pinned: Optional[PinnedCard], task_state: str, latest_card: dict) -> PinnedCard: if task_state in ("completed", "failed", "canceled"): # Terminal: safe to renegotiate for future dispatch, but this call has no continuation to bind. return admit_task(pinned.task_id if pinned else "unknown", latest_card) if pinned is None: raise CapabilitySnapshotUnavailable( "no admitting card snapshot for task in non-terminal state; refusing to " "fall back to latest card (would be unguarded renegotiation)" ) if hash_card(latest_card) != pinned.snapshot_hash: # Card changed mid-task. Do NOT cancel, do NOT adopt. Continue under pinned snapshot. return pinned return pinned def continue_task(pinned: Optional[PinnedCard], task_state: str, latest_card: dict, payload: dict) -> dict: resolved = resolve_continuation(pinned, task_state, latest_card) required_mode = payload.get("mode", "application/json") if required_mode not in resolved.input_modes: raise MidTaskRenegotiationAttempt( f"payload mode {required_mode!r} not in admitting snapshot " f"{resolved.input_modes} for task {resolved.task_id}" ) return {"taskId": resolved.task_id, "snapshotHash": resolved.snapshot_hash, "accepted": True} ```