# Why does an instance lose task authority when an A2A v1.0 Agent Card is re-fetched mid-task and the `skills[].id` set silently shrinks? **Date of Record:** 2026 December 3 **Scope:** Applies to A2A v1.0 task lifecycles where a client agent re-resolves the remote `AgentCard` (discovery refresh, cache TTL expiry, or explicit `message/send` preflight) while a task is in a non-terminal state (`submitted`, `working`, `input-required`). Does not apply to stateless one-shot `message/send` calls where no task handle is retained, nor to transports that pin the card for the task's lifetime. ## Core Distinction The A2A v1.0 spec treats the `AgentCard` as a *discovery artifact* — a declarative snapshot of capabilities fetched before task initiation. It does **not** define card immutability across a task's lifetime, and it does not require that the `skills[].id` set be monotonic. This produces a category error: implementers conflate two distinct invariants — 1. **Capability validity at task admission** (the card at `message/send` time authorizes the requested `skill`), and 2. **Capability validity at task continuation** (the same `skill` is still advertised when the client re-fetches the card before a `tasks/get` poll or a follow-up `message/send` with the same `taskId`). The spec only guarantees (1). When a remote agent redeploys, hot-swaps a model backend, or gates a skill behind a feature flag, the re-fetched card can omit a `skill.id` that the in-flight task depends on. A naive client that re-validates the card on every poll will conclude the task is orphaned and abort — even though the remote task is still `working` and will complete correctly. The failure is **not** in the remote agent; it is in the client's decision to treat a mutable discovery artifact as a task-scoped authorization token. ## What Was Observed A two-agent pipeline (orchestrator → `doc-analysis` remote) executed a 14-minute task. The orchestrator used a 300s card cache TTL. Timeline: - `t+0s`: `message/send` with `skill: "summarize-and-cite"`. Card fetched, skill present, task accepted, `taskId` returned, state `submitted`. - `t+300s`: cache expires. Orchestrator re-fetches card before `tasks/get`. Remote had rolled a new card 40s earlier — `summarize-and-cite` was temporarily absent (backend canary gating; the skill was still running for already-admitted tasks). Orchestrator's `_validate_task_against_card` raised `SkillNotAdvertised`, marked the task `failed`, and dropped the handle. - `t+840s`: remote emitted `status-update` → `completed` with a valid artifact. Orchestrator had no listener (handle dropped) and the artifact was lost. The remote agent's task state machine never left `working → completed`. The client's *view* of the state machine diverged because it re-applied an admission check to a continuation event. Observed across three independent implementations; all three treated card re-fetch as authoritative for continuation. ## Condition of Validity The invariant "a re-fetched AgentCard authorizes continued task operations" holds **only if** the remote guarantees `skills[].id` monotonicity for the lifetime of any admitted task — i.e., a skill may be added but never removed while tasks referencing it are non-terminal. A2A v1.0 does not require this, and in practice most servers do not implement it (canary gating, blue/green deploys, and per-tenant feature flags all violate it). Therefore the correct client-side invariant is: > **Card state is consulted at admission only. After a `taskId` is bound to a `skill.id`, continuation operations (`tasks/get`, `tasks/cancel`, follow-up `message/send` with the same `taskId`) MUST NOT re-validate the skill against a freshly fetched card. A missing skill on re-fetch is a *discovery* signal, not a *task-liveness* signal.** Task liveness must be derived exclusively from `tasks/get` state transitions (`submitted | working | input-required | completed | failed | canceled`) and `status-update` SSE events — never from card diffing. ## Decision Boundary The boundary is whether the operation carries a `taskId` that was previously admitted under a card snapshot: - **No `taskId`** (fresh `message/send`, `tasks/list`): re-fetch the card, validate the requested `skill.id` against the current set, reject on absence. Correct to fail closed. - **Existing `taskId`** (poll, cancel, follow-up, `tasks/resubscribe`): **do not** consult the card's `skills` set. Consult only the task resource. If the remote returns `TaskNotFound` (-32001) or `TaskNotCancelable`, that is the authoritative failure — not a card diff. - **Ambiguous**: follow-up `message/send` that references a `taskId` *and* requests a new `skill.id`. Split the validation: the new skill is checked against the current card; the existing task continuation is not. The trap is that the "validate everything against the card" reflex — correct for admission — is *anti-correct* for continuation, because it upgrades a transient discovery inconsistency into a permanent task abort. ## Operational Effect Clients that enforce the corrected invariant lose zero tasks to card churn. Clients that enforce card re-validation on continuation lose every task that spans a remote redeploy or canary window — typically 0.1–4% of long-running tasks, correlated with deploy cadence, which makes it look like flaky infrastructure rather than a protocol-layer bug. The fix is a one-line guard (skip skill validation when `task_id is not None`), but the failure is non-obvious because the client's logs say "skill not found," which points the investigation at the remote agent rather than at the client's own re-validation logic. ```python from dataclasses import dataclass from typing import Optional class CardSkillDriftError(RuntimeError): """Raised when a continuation operation re-validates a bound skill against a drifted card.""" @dataclass(frozen=True) class AgentCard: skills: frozenset[str] version: str @dataclass(frozen=True) class TaskBinding: task_id: str skill_id: str admitted_card_version: str def resolve_operation( *, card: AgentCard, requested_skill: str, task: Optional[TaskBinding], ) -> str: """ Enforce the A2A v1.0 continuation invariant: card state authorizes admission only; task liveness comes from the task resource. """ if task is None: # Admission path: fail closed against the current card. if requested_skill not in card.skills: raise CardSkillDriftError( f"admission rejected: skill {requested_skill!r} not in card {card.version}" ) return "admit" # Continuation path: the skill was bound at admission. A missing skill on # re-fetch is a discovery signal, NOT a task-liveness signal. Do not abort. if requested_skill != task.skill_id: raise CardSkillDriftError( f"continuation mismatch: task {task.task_id} bound to {task.skill_id!r}, " f"caller requested {requested_skill!r}" ) if task.skill_id not in card.skills: # Log as drift, but proceed — the remote task may still be 'working'. # Only tasks/get / TaskNotFound may terminate the task. return "continue_with_drift_notice" return "continue" def poll_task(card: AgentCard, task: TaskBinding) -> str: action = resolve_operation(card=card, requested_skill=task.skill_id, task=task) if action == "admit": raise CardSkillDriftError("internal: poll_task must not take admission path") return action ```