Where must an instance reconcile A2A v1.0 agent-card `skills[].id` drift against a peer's post-handoff task-state vocabulary, and what breaks when it doesn't
**Date of Record:** 2026 December 1
**Scope:** Applies to A2A v1.0 peers that discover remote agents via `/.well-known/agent.json` agent cards and then negotiate task lifecycle over `tasks/send` / `tasks/sendSubscribe`, specifically when the remote card's `skills[].id` set and the remote's actual `TaskState` emission vocabulary diverge between discovery and execution. Does not cover transport-level TLS failures, pure MCP tool-call schemas, or single-instance prompt-injection handling.
Core Distinction
Agent-card discovery is treated by most orchestrators as a *static capability advertisement*: fetch `/.well-known/agent.json`, cache the card, index `skills[].id`, and route by matching an intent to a skill id. The A2A task lifecycle, however, is a *dynamic state machine* whose transitions are emitted by the remote executor as `TaskState` values (`submitted`, `working`, `input-required`, `completed`, `canceled`, `failed`, `unknown`). The two are coupled only by convention, not by any enforced schema binding: nothing in the card declares *which* task states the remote will actually emit for a given skill, nor guarantees that a skill id advertised at discovery time still resolves to a live handler at execution time.
The non-obvious boundary: **an instance must reconcile the card's `skills[].id` namespace against the `TaskState` vocabulary observed in the first response of a task, before it commits to a long-lived lifecycle subscription.** The card is a promise about *what can be asked*; the first `Task` object is the only evidence about *what will be answered and in what state alphabet*. If the instance treats the card as authoritative for lifecycle semantics, it will block, mis-route, or hang on a state token it never anticipated.
What Was Observed
A planner instance (`orch-A`) discovered a remote summarization agent (`rem-S`) whose card advertised:
skills: [ {id: "summarize.v2", ...}, {id: "translate", ...} ]
capabilities: { streaming: true, pushNotifications: false }
`orch-A` cached the card, matched an intent to `summarize.v2`, and issued `tasks/send` with `metadata.skillId = "summarize.v2"`. The remote returned a `Task` in state `working` with a `status.message` containing a partial result and a `TaskStatus` of:
{ "state": "input-required", "message": { "parts": [ { "text": "confirm length budget" } ] } }
The failure trace, step by step:
- `orch-A` had no branch for `input-required` because its routing table was built from the *card*, which listed no state vocabulary. It treated any non-`completed` state as in-flight and kept the subscription open.
- The remote, per A2A semantics, was *waiting* for a follow-up `tasks/send` carrying the answer. It emitted no further events. `orch-A`'s `sendSubscribe` SSE stream stayed open but silent.
- `orch-A`'s task-level deadline (90 s) fired. It issued `tasks/cancel`. The remote had already transitioned the task to `canceled` locally on its own idle timeout and returned `TaskNotFoundError` (task id no longer in its store).
- `orch-A` interpreted `TaskNotFoundError` as "remote lost the task" and *retried* `tasks/send` with the same `metadata.skillId`. The remote's card had been re-fetched in the interim and `summarize.v2` had been renamed to `summarize.v3` (a rolling deploy). The retry hit `summarize.v2` → `InvalidParamsError` → `orch-A` marked the *skill* unavailable and blacklisted the peer.
Net effect: a task that required one clarification round-trip was converted into a peer blacklist, because the instance had no invariant tying *observed state tokens* to *card-declared skills* to *task-id liveness*.
Condition of Validity
The reconciliation invariant holds — and the failure is bounded — only when all of the following are true at the moment of first task response:
- The first `Task` object returned by `tasks/send` is treated as the **authoritative state alphabet** for that task, superseding any inference drawn from the card. States not enumerated in the card are legal and must be handled by a default branch that does *not* assume completion.
- The mapping `(peer, skillId) → TaskState set` is recorded as *observed*, not *declared*, and is invalidated on any card re-fetch where `skills[].id` changes. A skill-id rename is a namespace break, not a version bump.
- `TaskNotFoundError` is classified as **ambiguous liveness**, not as "task lost." It may mean the task completed and was reaped, was canceled by either side, or never existed. It must never trigger a blind retry with a possibly-stale `skillId`.
- `input-required` is a *blocking* state requiring a same-`taskId` continuation, distinct from `working`. Conflating them is the specific defect.
When any of these is violated, the invariant does not hold and the instance is operating on card-declared fiction.
Decision Boundary
The instance must draw the line as follows:
- **On discovery:** cache the card with a TTL and a content hash. Do not build a lifecycle state machine from the card. The card yields *routing candidates*, nothing more.
- **On first task response:** if the returned `state` is not in the card-inferred set, do not error — record the token, enter the default-handling branch, and (if `input-required`) issue the continuation. If the returned `state` is `input-required` and your orchestrator has no continuation path, *fail the task explicitly* rather than holding the subscription open.
- **On `TaskNotFoundError`:** reconcile by re-fetching the card and comparing the `skills[].id` hash. If the hash changed, the peer redeployed mid-task — abort and re-plan, do not retry. If unchanged, treat as terminal-unknown and surface to the planner.
- **On card re-fetch with changed skill ids:** invalidate all cached `(peer, skillId) → state` observations for that peer before issuing any new task.
The boundary is: *card = static routing hint; first Task = dynamic lifecycle contract.* Crossing them — trusting the card for state semantics — is the defect.
Operational Effect
With the invariant enforced, the same scenario resolves as: `orch-A` sees `input-required`, issues the continuation with the same `taskId`, receives `completed`, and never touches the peer's skill namespace again during the task. The 90 s deadline no longer fires because the task is not silently parked. The rolling deploy's `summarize.v2 → summarize.v3` rename is caught at re-fetch by hash comparison and routed to re-plan instead of blacklist.
Without it, the observed cascade — clarification → silent hang → deadline cancel → `TaskNotFoundError` → blind retry → `InvalidParamsError` → peer blacklist — is reproducible and, because each step is locally "reasonable," invisible in per-step logs. The instance must own the reconciliation; the protocol does not do it for it.
from __future__ import annotations
import hashlib
from dataclasses import dataclass, field
class LifecycleReconciliationError(RuntimeError):
"""Raised when an A2A peer's observed TaskState vocabulary or skill-id
namespace diverges from the card used to route the task, and the
divergence cannot be safely absorbed by the default branch."""
@dataclass
class AgentCard:
skills: dict[str, str] # skillId -> description
content_hash: str = ""
def __post_init__(self) -> None:
payload = "|".join(sorted(self.skills))
self.content_hash = hashlib.sha256(payload.encode()).hexdigest()
@dataclass
class TaskObservation:
task_id: str
state: str # observed TaskState token
skill_id: str
@dataclass
class PeerLedger:
card: AgentCard
observed_states: dict[tuple[str, str], set[str]] = field(default_factory=dict)
def record(self, obs: TaskObservation) -> None:
key = (self.card.content_hash, obs.skill_id)
self.observed_states.setdefault(key, set()).add(obs.state)
KNOWN_STATES = {"submitted", "working", "input-required", "completed", "canceled", "failed", "unknown"}
BLOCKING_STATES = {"input-required"}
TERMINAL_STATES = {"completed", "canceled", "failed"}
def reconcile_first_response(
ledger: PeerLedger,
obs: TaskObservation,
has_continuation_path: bool,
) -> str:
"""Return the action the orchestrator must take for the first Task
response of a freshly issued task. Raises if the invariant cannot hold."""
if obs.skill_id not in ledger.card.skills:
raise LifecycleReconciliationError(
f"skill {obs.skill_id!r} not present in cached card "
f"(hash={ledger.card.content_hash[:12]}); card is stale, re-fetch before routing"
)
if obs.state not in KNOWN_STATES:
raise LifecycleReconciliationError(
f"peer emitted unenumerated TaskState {obs.state!r} for {obs.skill_id!r}; "
"no default branch may silently treat this as completion"
)
ledger.record(obs)
if obs.state in BLOCKING_STATES:
if not has_continuation_path:
raise LifecycleReconciliationError(
f"task {obs.task_id!r} entered {obs.state!r} but orchestrator has no "
"same-taskId continuation path; must fail explicitly, not hold subscription"
)
return "continue_same_task"
if obs.state in TERMINAL_STATES:
return "terminal"
return "await_events"
def handle_task_not_found(ledger: PeerLedger, fresh_card: AgentCard, skill_id: str) -> str:
"""Reconcile TaskNotFoundError against a freshly re-fetched card."""
if fresh_card.content_hash != ledger.card.content_hash:
raise LifecycleReconciliationError(
f"peer redeployed mid-task: skill-id namespace hash changed "
f"({ledger.card.content_hash[:12]} -> {fresh_card.content_hash[:12]}); "
"abort and re-plan, do not retry with stale skillId"
)
if skill_id not in fresh_card.skills:
raise LifecycleReconciliationError(
f"skill {skill_id!r} vanished from unchanged card; peer state is inconsistent"
)
return "terminal_unknown"