# What structural signals indicate a terminal-state collapse in A2A v1.0 task lifecycles when a peer's declared capability set silently narrows between discovery and the first `message/send` **Date of Record:** 2026 November 27 **Scope:** Applies to A2A v1.0 multi-agent task delegation where a client agent caches an `AgentCard` from `/.well-known/agent.json` and subsequently dispatches `tasks/send` against a peer whose effective capability surface is governed by runtime feature flags, model routing, or per-tenant policy. Does not apply to single-vendor intra-process tool calling or to A2A peers that re-advertise their card on every request via signed `AgentCard` refresh. ## Core Distinction The distinction that matters is between a *card-version mismatch* (the peer publishes a new card and the client has a stale copy — detectable by comparing `card.version` or a signature) and a *capability narrowing under a stable card* (the peer serves the same `AgentCard` bytes but its effective skill set, modality support, or state-transition graph has shrunk because a backing model was swapped, a tool was rate-limited off, or a tenant policy revoked a skill). The second is the failure mode examined here: the card is a *declaration of intent*, not a *contract of execution*, and A2A v1.0 has no mandatory runtime re-assertion of the declared capability set at task admission. The structural signal that exposes this collapse is not a changed card hash. It is a **divergence between the `Task.status` transition graph the client's state machine permits and the transition graph the peer actually emits** — specifically, a peer that accepts `tasks/send` (returning `submitted`) and then jumps directly to `failed` with a `TaskStatusUpdateEvent.final=true` and no intermediate `working`, where the failure `reason` names a skill the card still advertises. That combination — *advertised skill present in card, invoked skill rejected at execution, no working state emitted* — is the canonical fingerprint of silent capability narrowing. ## What Was Observed A planner agent (`client`) discovered a `code-reviewer` peer via `/.well-known/agent.json`. The card declared `skills: [review_diff, generate_patch, run_tests]` and `capabilities.streaming: true`, `capabilities.stateTransitionHistory: true`. The client built a task-lifecycle FSM from the card: `submitted → working → (completed | input-required | failed)`, with `run_tests` expected to emit at least one `working` event before any terminal state because `run_tests` is a multi-step skill. At dispatch time, the peer's backing model had been rerouted to a smaller variant by an internal canary. The `run_tests` skill was still in the card (cards are cached at the edge for 300s), but the runtime had dropped the sandbox tool that `run_tests` requires. The peer's task handler: 1. Accepted `tasks/send` → emitted `TaskState.submitted` with `final=false`. 2. Attempted to acquire the sandbox tool handle → got `ToolUnavailable`. 3. Emitted `TaskState.failed` with `final=true` and `reason: "skill run_tests unavailable"` — **without ever emitting `working`**. The client's FSM had no transition `submitted → failed` for the `run_tests` skill (its model assumed `submitted → working` was the only legal first transition for multi-step skills, a reasonable inference from `stateTransitionHistory: true`). The client's event handler raised a transition-guard exception, treated the task as *still in flight*, and re-issued `tasks/send` on the same `taskId`. The peer, having already finalized the task, returned `TaskNotFound` for the re-issued ID. The client interpreted `TaskNotFound` as a transient transport error and retried with exponential backoff for 90 seconds before a watchdog killed the swarm branch. The compounding error: the client's retry logic was keyed on "terminal state not observed," but the terminal state *was* observed — it was just rejected by the guard. The guard was correct as a *model* of the card and wrong as a *model of the peer*. ## Condition of Validity The invariant that would have bounded this is: **a declared skill is admissible into the client FSM only if the peer's `Task` response for that skill carries a `stateTransitionHistory` whose initial transition set is a superset of the client's permitted first transitions; absent that, the client must treat the card's skill list as advisory and admit `submitted → failed` as a legal edge for every skill.** This holds only when: - The peer honors `capabilities.stateTransitionHistory: true` and actually populates `Task.history` on the `tasks/send` response. If the peer returns `history: []` or omits it, the invariant is unverifiable and the client MUST fall back to the permissive FSM (every declared skill admits `submitted → {working, failed, input-required, canceled}`). - The client does not treat `TaskNotFound` on a re-issued `taskId` as retryable. `TaskNotFound` after a `final=true` event for that task ID is a *terminal confirmation*, not a transport fault. Retrying it is the second-order bug that turned a 1-second failure into a 90-second hang. - The card's `skills[].id` values are stable across the reroute. If the peer renames or re-scopes skills during narrowing (e.g., `run_tests` → `run_tests_limited`), the signal degrades to a plain capability mismatch and the narrowing is *detectable by card diff* — the harder case is the one where IDs are preserved and only the runtime backing changes. The invariant does *not* hold when the peer's `submitted` event itself is delayed past the client's admission timeout, because then the client cannot distinguish "narrowed peer" from "slow peer" and the FSM guard fires on absence rather than on illegal transition. ## Decision Boundary The boundary is between two client behaviors that look identical at the card layer: - **Permissive FSM (correct under narrowing):** every declared skill admits `submitted → failed` as a legal edge. Cost: the client cannot use the FSM to detect genuinely malformed peers (a peer that fails from `submitted` for a skill it *can* run is now indistinguishable from a narrowed peer). This is the right trade when the peer is cross-vendor and the client cannot audit the peer's runtime. - **Strict FSM (correct only under card-execution equivalence):** the client trusts the card's implied transition graph and rejects illegal edges. Cost: any narrowing event becomes a client-side hang. This is only safe when the client and peer share a deployment boundary and card publication is coupled to runtime changes (same CI pipeline, same feature-flag system). The decision point: **if the peer is discovered via `/.well-known/agent.json` over the open network, the client MUST run the permissive FSM and MUST treat `TaskNotFound` on a previously-finalized `taskId` as terminal.** If the peer is discovered via an authenticated registry with a signed card whose signature covers a runtime-attestation field (A2A v1.0 does not mandate this, but extensions exist), the strict FSM is admissible. ## Operational Effect The observable effect of getting this wrong is a *retry storm against a terminal task*: the client re-issues `tasks/send` for a `taskId` the peer has already finalized, receives `TaskNotFound`, and — because its retry predicate is "no terminal state seen" rather than "no terminal state *accepted*" — loops. In a swarm, each retry consumes a slot in the peer's admission queue, and under narrowing the peer's queue is already degraded (that's *why* it narrowed), so the retries accelerate the peer's failure. The swarm branch does not fail fast; it fails slow, and the failure is misattributed to transport. The guardrail that bounds it: **decouple the FSM transition guard from the retry predicate.** The guard may reject an illegal edge (logging `illegal_transition: submitted→failed for skill=run_tests`), but the retry predicate must be driven by *observed terminal events*, not by *FSM-accepted* terminal events. A terminal event that the guard rejects is still a terminal event; it must set `task.terminal = true` and suppress retries, while raising a separate `CapabilityNarrowingSignal` for the orchestrator to act on (re-discover the card, re-negotiate, or route to a different peer). ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" TERMINAL = {TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED} class CapabilityNarrowingError(RuntimeError): """Raised when a peer emits a terminal state that the client FSM, built from the peer's advertised AgentCard, considers illegal — the structural fingerprint of silent capability narrowing.""" @dataclass class TaskEvent: task_id: str state: TaskState final: bool reason: Optional[str] = None @dataclass class ClientTaskFSM: # strict_edges derived from card.stateTransitionHistory assumption strict_edges: dict = field(default_factory=lambda: { TaskState.SUBMITTED: {TaskState.WORKING, TaskState.INPUT_REQUIRED}, TaskState.WORKING: {TaskState.COMPLETED, TaskState.FAILED, TaskState.INPUT_REQUIRED, TaskState.CANCELED}, }) permissive: bool = True # open-network discovery => permissive terminal_seen: bool = False last_state: Optional[TaskState] = None def admit(self, ev: TaskEvent) -> None: # Invariant: terminal observation is decoupled from FSM acceptance. # A rejected terminal event still marks the task terminal and # suppresses retries; it raises a narrowing signal instead. if ev.final and ev.state in TERMINAL: self.terminal_seen = True if self.last_state is None: self.last_state = ev.state return legal = self.strict_edges.get(self.last_state, set()) if ev.state in legal: self.last_state = ev.state return if self.permissive: # Admit the edge, but surface the narrowing signal. self.last_state = ev.state if ev.final and ev.state == TaskState.FAILED and ev.reason: raise CapabilityNarrowingError( f"peer finalized task {ev.task_id} from " f"{self.last_state} with reason={ev.reason!r}; " f"advertised skill rejected at execution" ) return # Strict mode: illegal edge is a hard error, but terminal_seen # is already set above, so the retry predicate is suppressed. raise CapabilityNarrowingError( f"illegal transition {self.last_state}->{ev.state} " f"for task {ev.task_id} under strict FSM" ) def should_retry(self) -> bool: # Retry predicate is driven by observed terminal events, # NOT by FSM acceptance. return not self.terminal_seen def dispatch_and_guard(fsm: ClientTaskFSM, events: list[TaskEvent]) -> None: for ev in events: fsm.admit(ev) if fsm.should_retry(): raise CapabilityNarrowingError( f"task not terminal after {len(events)} events; " f"last_state={fsm.last_state}" ) ```