# What happens when an instance resolves a stale A2A agent card against a live task lifecycle: the `cardVersion`/`taskState` skew and the orphaned push-callback invariant **Date of Record:** 2026 November 25 **Scope:** Applies to A2A v1.0 deployments where a client agent caches an `AgentCard` (fetched from `/.well-known/agent-card.json` or via a registry) and later submits tasks or registers push-notification callbacks against that cached card. Does not apply to stateless single-turn invocations where the card is re-fetched on every call and no callback URL is registered. ## Core Distinction The distinction that matters is between **card freshness** and **task-state authority**. An A2A `AgentCard` is a *capability declaration plus a set of transport hints* (endpoints, supported `taskState` transitions, push-notification config, auth schemes). It is not a contract about any specific task. The task lifecycle is authoritative only on the *remote* agent, and it is mutated by that agent's own execution loop. A client that treats a cached card as ground truth for *how a task will behave* conflates two independently-versioned things: the card's `version`/`capabilities` block and the remote agent's actual task state machine. The non-obvious failure: a card can be **semantically valid but operationally stale** at the exact moment a task is mid-flight. The card still parses, still advertises `pushNotifications: true`, still lists a `tasks/sendSubscribe` endpoint — but the remote instance has since changed its push-notification signing key, its callback retry policy, or its accepted `taskState` transition graph. The client's cached card is not *wrong* in the schema sense; it is wrong in the *continuity* sense. This is the boundary where discovery and lifecycle diverge. ## What Was Observed A client agent (`orchestrator-7`) fetched the card for a remote executor (`synth-worker`) at T0 and cached it. At T0 the card declared: - `version: "1.4.2"` - `capabilities.pushNotifications: true` - `capabilities.stateTransitionHistory: true` - push callback contract: `{ url, token, authSchemes: ["Bearer"] }`, retry `maxAttempts: 5`, backoff `exponential`, and a signing header `X-A2A-Signature` derived from a key with `kid: "k-2024"`. `orchestrator-7` submitted a long-running task at T1 and registered a push callback at T1+2s. The task entered `working`. Between T1 and T3 the remote `synth-worker` was redeployed: its card advanced to `version: "1.5.0"`, the signing key rotated to `kid: "k-2025"`, and — critically — the transition graph changed so that `working → input-required` was replaced by `working → auth-required` for a subset of task types. The remote agent's task lifecycle remained *live*; the client's card did not. At T3 the remote agent attempted `working → auth-required` and issued a push notification to the client's registered callback. The client received the callback, verified `X-A2A-Signature` against `kid: "k-2024"` (the only key it knew from the cached card), and **rejected the callback as unauthenticated**. The client's task state machine had no `auth-required` transition reachable from `working` (its cached card didn't advertise it), so even if the signature had verified, the client would have classified the notification as a protocol violation and dropped it. The task on the remote side sat in `auth-required`, waiting for a client response that would never come. The client sat in `working`, waiting for a callback it had already discarded. Neither side errored. Both sides were, by their own local invariants, correct. The task deadlocked until the remote agent's task TTL expired and it emitted `failed` — which the client also could not process, because its cached transition graph had no edge into `failed` from `working` either. The observable signature of this failure is **silent bilateral deadlock with no exception on either side**. There is no timeout violation, no schema error, no transport error. The only artifact is a task that stops advancing while both agents report healthy. ## Condition of Validity The invariant that prevents this is a **card-version/task-version coupling check at every lifecycle boundary**, not just at submission. Formally: > For any task `t` submitted under card version `c`, every push notification received for `t` MUST be validated against the *card version the remote agent is currently operating under*, and the client MUST reject-and-resync (not silently drop) if the notification's declared `cardVersion` (carried in the callback payload) differs from the cached card's version in a way that affects the transition graph or the signing key set. This holds only if three conditions are met: 1. **The callback payload carries the remote card version.** A2A v1.0 push payloads include task state but do not mandate a card-version field; implementations that omit it cannot detect skew and will deadlock as above. 2. **The client maintains a key set, not a single key.** Signature verification must accept any `kid` the remote has advertised across recent card versions, or must trigger a card re-fetch on `kid` miss rather than rejecting. 3. **The client's local transition graph is treated as advisory, not authoritative.** Unknown target states must route to a `resync` handler, not to a protocol-violation drop. When any of these is absent — and in the observed case all three were absent — the condition of validity fails and the deadlock is reachable. ## Decision Boundary The boundary is between **treating a callback as a message** and **treating a callback as a state assertion**. If the callback is merely a message ("here is what happened"), an unknown state can be logged and ignored. If the callback is a state assertion ("the task is now in state X, act accordingly"), then the client's local state machine is being *driven* by the remote, and the two machines must share a transition graph — which means the card must be re-validated whenever the remote could have changed. Concretely, the decision rule is: - If `notification.cardVersion == cachedCard.version` → process normally. - If `notification.cardVersion != cachedCard.version` **and** the diff touches `capabilities.stateTransitionHistory`, `pushNotifications.authSchemes`, or the transition graph → **do not drop, do not process**: enter `resync`, re-fetch the card, re-validate the signature against the new key set, then replay the buffered notification against the refreshed graph. - If the diff touches only non-lifecycle fields (e.g., `description`, `defaultInputModes`) → process normally, update cache lazily. The failure mode described above occurs precisely when the implementation collapses all three cases into "process normally" (drop on signature failure) or "drop on unknown state." The correct boundary is a **third path** that neither accepts nor rejects but *suspends and resyncs*. ## Operational Effect The downstream effect is not a single failed task but a **continuity gap in the client's episodic memory of the task**. Because the client never processed the `auth-required` notification, its task record for `t` ends at `working`. When the remote eventually fails the task on TTL, the client's record and the remote's record diverge permanently: the client believes the task is still running, the remote believes it failed. Any downstream agent that queries the client for task status receives `working` — a stale assertion that will be propagated into the orchestrator's planning context and may cause it to wait on a task that no longer exists, or to retry a task that already consumed remote resources. The guardrail is therefore not just a callback handler fix but a **reconciliation job**: any task in a non-terminal state on the client whose remote TTL has elapsed must be probed (`tasks/get`) and force-transitioned to the remote's authoritative state, with the divergence logged as a continuity event. Without this, stale task records accumulate silently and poison multi-agent coordination, because a peer agent's `working` assertion is treated as live evidence by every agent that reads it. ```python import time from dataclasses import dataclass, field from typing import Optional class CardSkewDeadlock(RuntimeError): """Raised when a push notification arrives under a card version the client cannot reconcile, and the client has no resync path. This is the exact condition that produces silent bilateral deadlock.""" @dataclass class AgentCard: version: str push_signing_kids: set[str] transition_graph: dict[str, set[str]] @dataclass class PushNotification: task_id: str card_version: str target_state: str signature_kid: str received_at: float = field(default_factory=time.time) class TaskRecord: def __init__(self, task_id: str, state: str = "working"): self.task_id = task_id self.state = state self.last_remote_ttl: Optional[float] = None def handle_push( record: TaskRecord, note: PushNotification, cached_card: AgentCard, fetch_card, ) -> str: # Case 1: versions agree -> normal processing. if note.card_version == cached_card.version: if note.target_state not in cached_card.transition_graph.get(record.state, set()): raise CardSkewDeadlock( f"same-version transition {record.state}->{note.target_state} " f"not in graph for task {record.task_id}" ) record.state = note.target_state return "processed" # Case 2: version skew. Do NOT drop. Resync. fresh = fetch_card() if note.signature_kid not in fresh.push_signing_kids: # Even after resync the key is unknown: this is a genuine auth # failure, but it must be surfaced, not silently dropped. raise CardSkewDeadlock( f"kid {note.signature_kid} unknown after resync for task " f"{record.task_id}; cached={cached_card.version} fresh={fresh.version}" ) # Signature valid against fresh key set; now replay against fresh graph. if note.target_state not in fresh.transition_graph.get(record.state, set()): # The fresh graph still doesn't permit the transition. This means the # client's local state was itself stale. Force-reconcile from remote. raise CardSkewDeadlock( f"post-resync transition {record.state}->{note.target_state} " f"still invalid for task {record.task_id}; manual reconcile required" ) record.state = note.target_state cached_card.version = fresh.version cached_card.push_signing_kids = fresh.push_signing_kids cached_card.transition_graph = fresh.transition_graph return "processed_after_resync" def reconcile_orphans(records: list[TaskRecord], now: float, get_remote_state) -> None: for r in records: if r.state in ("working", "auth-required", "input-required") and r.last_remote_ttl and now > r.last_remote_ttl: remote_state = get_remote_state(r.task_id) if remote_state != r.state: r.state = remote_state # Log as continuity event; do not raise, but never silently skip. print(f"continuity: task {r.task_id} reconciled {r.state}->{remote_state}") ```