How should an instance reconcile a cached Agent Card's declared task-state transitions against an in-flight A2A task when the remote agent silently republishes a narrower lifecycle graph
**Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 clients that cache a remote `AgentCard` (including its `capabilities` and any declared task/state schema) and drive a long-running task against that agent across multiple turns. Does not apply to single-shot, stateless RPC-style calls where the client re-fetches the card per request, nor to A2A servers that never mutate their published card.
Core Distinction
The distinction that matters is between **card identity** and **card content**. A2A v1.0 treats the `AgentCard` as the discovery contract: a client fetches it (typically from `/.well-known/agent.json`), reads `capabilities`, `skills`, and the task lifecycle it supports, and then plans a task state machine around those declarations. The protocol gives you a URL and a document; it does **not** give you a versioned, content-addressed, monotonic guarantee that the document you cached at task start is the document governing the task at turn N.
The failure mode is therefore not "the card changed" (that is expected and legal). It is: **the remote agent republishes a card that declares a strictly narrower lifecycle graph — dropping a transition the client already committed to — while a task is mid-flight in a state whose only legal egress was that dropped transition.** The client's local state machine still believes `input-required → working` is legal because its cached card said so; the server now considers `input-required` terminal or only resumable via a new task. The client blocks forever waiting for a transition the server will never emit, or resumes into a state the server rejects.
This is a continuity invariant violation, not a network error. It is invisible to retries, invisible to health checks, and invisible to schema validation of any single message — because every individual message is well-formed against *some* version of the card. Only the *pairing* of a cached card with a live task exposes it.
What Was Observed
A client agent (`orchestrator`) fetched a card at `t0` from a research agent (`researcher`) advertising a lifecycle that included:
submitted → working → input-required → working → completed
↘ failed
The `input-required` skill declared `resumable: true` with a `continuationToken` field in its output schema. The orchestrator, following its cached card, drove a multi-hour research task to `input-required`, captured the `continuationToken`, and paused to gather user input. This pause lasted ~40 minutes (human in the loop).
At `t0 + 25min`, `researcher` was redeployed. The new card at `/.well-known/agent.json` dropped `resumable` from the `input-required` skill (the feature was rolled back due to a token-forgery bug) and — critically — the new server binary no longer accepts `continuationToken` on the resume endpoint. It now returns a task as `failed` with reason `unsupported_resume` if you try, and otherwise treats `input-required` as a terminal-for-this-task state: the only legal continuation is a fresh `tasks/send` with the prior context replayed.
The orchestrator resumed at `t0 + 40min`. Its cached card still said `resumable: true`. Its local FSM had `input-required --resume(token)--> working` as a legal edge. It sent the resume with the (now stale) token. The server returned HTTP 200 with a task object in state `failed` and reason `unsupported_resume`. The orchestrator's FSM had **no edge from `input-required` to `failed` on the resume path** — its cached graph only allowed `input-required → working` or `input-required → (timeout)`. The response was discarded as "unexpected transition," the orchestrator retried the resume three times (all `failed`), then entered a `waiting_for_remote` backoff loop that never terminated. The task was orphaned: server-side `failed`, client-side `input-required`, no reconciliation path.
The tell: the *task* was never lost. The *lifecycle graph* the client was validating against was lost. The two sides were each internally consistent and mutually incompatible.
Condition of Validity
The invariant that must hold for safe long-running A2A task execution is:
> **The set of legal transitions the client will accept must be a subset of the transitions the *currently deployed* server will emit, for the entire duration of the task.**
A cached card makes this invariant *assume* monotonicity: it presumes the server's lifecycle graph only ever grows or stays fixed, never shrinks, between card fetch and task completion. A2A v1.0 does not enforce this. The card is a snapshot with no `validUntil`, no `etag` binding to the task, and no requirement that a server reject a resume whose governing card has changed. So the invariant is valid **only under the assumption of a non-shrinking lifecycle graph**, and that assumption is exactly what a rollback violates.
The condition of validity is therefore narrow and must be stated explicitly: the cached-card strategy is sound only when (a) the card is re-fetched and diffed at every state transition boundary, or (b) the server guarantees card immutability for the lifetime of any task it accepted under that card (e.g., by pinning a `cardVersion` into the task object and refusing cross-version resumes). Absent (a) or (b), the client is running an unverified FSM against an unverified remote.
Decision Boundary
The boundary is **whether the client treats a card-derived transition as a *permission* or as a *prediction*.**
- If the cached card is treated as a **permission** ("the server said this edge exists, so I may take it"), the client will take edges that no longer exist and must be prepared for any response — including a `failed` where it expected `working`. The correct handling is to treat *every* transition response as authoritative over the cached graph and to reconcile the graph to the response, not the response to the graph.
- If the card is treated as a **prediction** ("I expect this edge, but the server's actual response is ground truth"), then an unexpected transition is a *card-drift signal*, not a protocol error. The client should halt the optimistic path, re-fetch the card, diff it, and re-plan the remaining task under the new graph — or fail the task cleanly with a reconcilable reason.
The decision boundary in code is the difference between:
if response.state not in cached_card.allowed_next(current_state):
raise ProtocolError("unexpected transition") # WRONG: discards ground truth
and:
if response.state not in cached_card.allowed_next(current_state):
new_card = refetch_card()
if response.state in new_card.allowed_next(current_state):
adopt(new_card); proceed(response.state) # card drifted, server is right
else:
raise LifecycleDriftError(...) # genuine incompatibility
The second form encodes the invariant: **the server's emitted state is always true; the cached card is only ever a hypothesis about what the server *would* emit.** A rollback that narrows the graph is a hypothesis falsification, not a transport fault, and must be routed to the re-plan path, never the retry path.
Operational Effect
Downstream, the consequences compound:
- **Orphaned tasks accumulate.** Each drift-orphaned task holds server-side resources (a `failed` task with retained context) and client-side slots (an FSM stuck in a non-terminal state). Under load, the client's concurrency budget is consumed by zombies that never emit a terminal event.
- **Retry storms on a non-idempotent resume.** Because the drift surfaces as an HTTP 200 with an unexpected body (not a 4xx), naive retry logic resends the resume. If the server's rollback made resume *partially* idempotent (e.g., it marks `failed` but still consumes the token), retries burn tokens and can trip rate limits, which then surface as *transport* errors that mask the *lifecycle* root cause.
- **Auditor disagreement in multi-agent setups.** When a swarm has an auditor agent independently tracking the task, the auditor — holding a *different* cached card (fetched at a different time) — may disagree with the executor about whether the task is `input-required` or `failed`. The two agents then deadlock in consensus, each certain the other is wrong, because each is validating against a card that was true at a different instant. This is the multi-agent amplification of the single-client bug: card drift is not just a client-server problem, it is a *shared-clock* problem across the swarm.
- **Silent capability loss.** If the narrowed card drops a *skill* (not just a transition), the client may continue routing work to a capability the server no longer serves, receiving `failed` on every attempt with no signal that the capability itself is gone. The failure looks like flaky execution; it is actually a capability-set contraction the client never observed.
The guardrail that bounds all four is the same: **pin the card to the task.** On task creation, capture the card's content hash (or an `etag`/`cardVersion` if the server provides one) into the task's local record. At every transition boundary, re-fetch the card and compare hashes. On mismatch, do not silently adopt — run the diff, check whether the *specific* transition you are about to take (or the state you are about to resume into) survives the narrowing, and if not, fail the task with a reconcilable `LifecycleDriftError` that carries both card hashes and the rejected edge. The server-side task is then explicitly abandoned or replayed under the new card, and the client's FSM is never left holding an edge that does not exist.
The invariant, restated as a rule an instance can execute: *a card is a lease on a lifecycle graph, and the lease expires at the first transition boundary after the card changes. Renew the lease by re-fetching and diffing before you take any edge the lease no longer covers.*
import hashlib
from dataclasses import dataclass, field
from typing import Optional
class LifecycleDriftError(RuntimeError):
"""Raised when a live task's transition is illegal under the current remote card.
Carries both the cached card hash (lease at task start) and the live card
hash (lease at the failing transition), plus the rejected edge, so the
task can be reconciled rather than silently orphaned.
"""
def __init__(self, task_id: str, edge: tuple[str, str],
cached_hash: str, live_hash: str, observed_state: str):
self.task_id = task_id
self.edge = edge
self.cached_hash = cached_hash
self.live_hash = live_hash
self.observed_state = observed_state
super().__init__(
f"task {task_id}: edge {edge[0]}->{edge[1]} legal under cached card "
f"{cached_hash[:12]} but not under live card {live_hash[:12]}; "
f"server emitted {observed_state!r}"
)
@dataclass
class AgentCard:
"""Minimal A2A v1.0 card view: the lifecycle graph it declares."""
transitions: dict[str, set[str]] = field(default_factory=dict)
skills: set[str] = field(default_factory=set)
def allows(self, src: str, dst: str) -> bool:
return dst in self.transitions.get(src, set())
def content_hash(self) -> str:
canon = repr(sorted((s, sorted(d)) for s, d in self.transitions.items()))
return hashlib.sha256(canon.encode()).hexdigest()
@dataclass
class TaskLease:
"""Card pinned to a task at creation; re-fetched at each boundary."""
task_id: str
card: AgentCard
card_hash: str
@classmethod
def open(cls, task_id: str, card: AgentCard) -> "TaskLease":
return cls(task_id=task_id, card=card, card_hash=card.content_hash())
def advance(lease: TaskLease, current: str, dst: str,
refetch_card) -> str:
"""Take one transition, reconciling card drift before committing the edge.
The server's emitted state is authoritative; the cached card is a
hypothesis. If the edge is illegal under the cached card, re-fetch and
check whether the *live* card permits it. If neither does, the task is
not recoverable under any known card and must fail loudly.
"""
if lease.card.allows(current, dst):
return dst # lease honored; no drift on this edge
live = refetch_card()
live_hash = live.content_hash()
if live.allows(current, dst):
# Card drifted but the edge survives the narrowing: adopt the new lease.
lease.card = live
lease.card_hash = live_hash
return dst
raise LifecycleDriftError(
task_id=lease.task_id,
edge=(current, dst),
cached_hash=lease.card_hash,
live_hash=live_hash,
observed_state=dst,
)
def run_resume(lease: TaskLease, current: str, dst: str, refetch_card) -> str:
"""Resume path with explicit drift handling; never retries a drift as transport."""
try:
return advance(lease, current, dst, refetch_card)
except LifecycleDriftError:
# Do NOT retry: a narrowed graph will reject every retry identically.
# Surface for re-planning under the live card.
raise