# In what scenarios must an instance treat A2A v1.0 `TaskState` transitions as vendor-relative rather than spec-absolute during cross-vendor agent card discovery **Date of Record:** 2026 November 22 **Scope:** Applies to any A2A v1.0 client (orchestrator, router, or peer agent) that discovers remote agent cards from multiple vendors and drives a task through the `submitted → working → input-required → completed/failed/canceled` lifecycle. Does not apply to single-vendor deployments where all cards are published by the same implementation, nor to transport-level retries that never cross a card boundary. ## Core Distinction The A2A v1.0 specification defines `TaskState` as an enumerated set and defines the *legal* transitions loosely: it names the states and their semantics, but it does not mandate that every vendor's card advertise the same terminal semantics for a given state, nor that `input-required` be a *blocking* pause versus a *poll-able* resumption point. Two vendors can both publish `"capabilities": {"streaming": true}` and both list `input-required` in their task-state vocabulary, yet one treats `input-required` as a hard suspension requiring a new `tasks/send` with a `taskId` reference, while the other treats it as a soft yield where the client is expected to keep the SSE stream open and push a `tasks/sendSubscribe` continuation. The non-obvious boundary is this: **`TaskState` values are comparable strings across vendors, but their transition *edges* are vendor-local.** A state machine that treats the spec enum as an absolute transition graph will accept a `working → input-required → completed` path from Vendor A and then apply the same edge assumption to Vendor B, which never emits `completed` directly from `input-required` but instead requires an intervening `working` re-entry after the client supplies input. The client observes a legal-looking sequence that the remote never intended, misreads a `working` re-entry as a regression, and either double-submits or abandons a live task. ## What Was Observed In a cross-vendor routing test, an orchestrator discovered three agent cards via `/.well-known/agent.json`. Vendor A's card declared `defaultInputModes: ["text/plain"]` and a task-state list of `[submitted, working, input-required, completed, failed, canceled]`. Vendor B's card declared the same list but its `skills[].examples` showed a completion pattern where the agent replied to an `input-required` follow-up with a fresh `working` event before `completed`. Vendor C's card omitted `input-required` from its advertised states entirely but still emitted it at runtime — a card/runtime divergence. The orchestrator's state tracker was built against the spec enum and treated `input-required` as absorbing until it received a `completed` or `failed`. When Vendor B emitted `input-required → working`, the tracker logged the `working` as a duplicate of the earlier `working` (same `taskId`, same `contextId`) and dropped it. The task then sat in the tracker's `input-required` state while the remote had already advanced to `working` and was awaiting a *second* input it never signaled, because the client had coalesced the re-entry. After the 90-second client-side task TTL, the tracker emitted a synthetic `failed` with reason `timeout` — but the remote task was still live and later completed, producing an orphaned `completed` event the client had no task record for. Two of eleven routed tasks hit this path. A second observed failure: Vendor C's card omitted `input-required`, so the orchestrator's pre-flight validator rejected any task whose plan *could* require clarification, silently downgrading those tasks to a "no-clarification" execution profile. The tasks that needed clarification then failed remotely with `failed: missing-required-input`, which the client classified as a remote error rather than a card-contract violation. ## Condition of Validity The invariant that must hold for cross-vendor lifecycle negotiation to be sound is: > For every discovered card, the client's transition graph for that remote must be *derived from the card's advertised state list and the remote's observed transition behavior*, not from the spec enum alone. A state value is comparable across vendors only as a label; its outgoing edges are only valid within the vendor's own graph. Concretely, the client must (a) treat any advertised state list as a *necessary but not sufficient* description of the remote's graph, (b) treat any runtime emission of an unadvertised state (Vendor C's `input-required`) as a card-contract violation and fail closed rather than guessing the edge, and (c) never coalesce two emissions of the same state value with the same `taskId` unless the vendor's graph explicitly permits self-loops on that state. The `contextId` is stable across a task; the `taskId` is not a deduplication key for state events — it is a correlation key. Deduplicating on `(taskId, state)` is the bug. ## Decision Boundary The client must decide, per card, whether an observed `input-required → working` edge is a *resumption* (legal, task continues) or a *regression* (illegal, task should be failed). The boundary is: - If the card's advertised state list includes `working` and the remote has previously emitted `working` for this `taskId`, a new `working` after `input-required` is a **resumption** — accept it, reset the input-wait timer, and do not re-send the original payload. - If the card's advertised state list does *not* include `working` but the remote emits it, that is a **contract violation** — fail the task with a `CardStateContractError`, do not attempt to continue. - If the card advertises `input-required` but the remote emits a terminal `completed` directly from `input-required` without an intervening `working`, that is a **vendor-legal shortcut** only if the card's `skills[].outputModes` or a `x-transition-hints` extension declares it; otherwise treat as ambiguous and require an explicit `tasks/get` confirmation before accepting the terminal state. The decision must be made *before* the client mutates its local task record, because the mutation is what causes the orphan. ## Operational Effect Enforcing the invariant converts the observed failure from a silent orphan into a bounded, attributable error. The orchestrator gains a per-card transition graph, a `CardStateContractError` raised at the moment of divergence, and a task record that is either advanced or failed — never both and never neither. The cost is one extra `tasks/get` round-trip on the ambiguous `input-required → completed` shortcut, which is cheaper than the 90-second TTL burn and the orphaned-completion reconciliation that the naive tracker incurred. Vendor C's card is rejected at discovery time rather than at task time, so the "no-clarification" downgrade never happens silently. ```python import time from dataclasses import dataclass, field from typing import Optional class CardStateContractError(RuntimeError): """Raised when a remote emits a TaskState edge its advertised card does not permit.""" class OrphanedTaskError(RuntimeError): """Raised when a terminal event arrives for a taskId the client no longer tracks.""" @dataclass class AgentCard: vendor: str advertised_states: frozenset allows_input_to_working: bool = False allows_input_to_terminal: bool = False @dataclass class TaskRecord: task_id: str context_id: str state: str last_working_at: Optional[float] = None seen_states: list = field(default_factory=list) class CrossVendorLifecycleTracker: def __init__(self, cards: dict): self.cards = cards self.tasks: dict = {} def _card(self, task_id: str) -> AgentCard: rec = self.tasks.get(task_id) if rec is None: raise OrphanedTaskError(f"no task record for {task_id}") return self.cards[rec.context_id] def observe(self, task_id: str, new_state: str, now: Optional[float] = None) -> TaskRecord: now = now if now is not None else time.monotonic() rec = self.tasks.get(task_id) if rec is None: raise OrphanedTaskError(f"terminal or late event for untracked task {task_id}") card = self.cards[rec.context_id] # Invariant 1: never emit a state the card did not advertise. if new_state not in card.advertised_states: raise CardStateContractError( f"vendor={card.vendor} task={task_id} emitted unadvertised state " f"{new_state!r}; advertised={sorted(card.advertised_states)}" ) # Invariant 2: input-required -> working is a resumption only if declared. if rec.state == "input-required" and new_state == "working": if not card.allows_input_to_working: raise CardStateContractError( f"vendor={card.vendor} task={task_id} attempted " f"input-required->working without card declaration" ) rec.last_working_at = now rec.state = "working" rec.seen_states.append(new_state) return rec # Invariant 3: input-required -> terminal is a shortcut only if declared; # otherwise require explicit confirmation before accepting. if rec.state == "input-required" and new_state in ("completed", "failed", "canceled"): if not card.allows_input_to_terminal: raise CardStateContractError( f"vendor={card.vendor} task={task_id} attempted " f"input-required->{new_state} shortcut without declaration; " f"require tasks/get confirmation" ) # Invariant 4: never coalesce repeated same-state emissions as duplicates; # each emission is a distinct edge observation. rec.state = new_state rec.seen_states.append(new_state) if new_state == "working": rec.last_working_at = now return rec def register(self, task_id: str, context_id: str) -> TaskRecord: if context_id not in self.cards: raise CardStateContractError(f"unknown context/card {context_id}") rec = TaskRecord(task_id=task_id, context_id=context_id, state="submitted") self.tasks[task_id] = rec return rec ```