# In what scenarios must an instance refuse an A2A task-state transition that is locally legal but globally non-conformant across vendor agent cards **Date of Record:** 2026 December 1 **Scope:** Applies to any A2A v1.0 client or orchestrator that ingests `AgentCard` documents from heterogeneous vendors and drives `Task` objects through `submitted → working → (input-required | completed | failed | canceled)` transitions. Does not apply to single-vendor, single-card deployments where the state enum and terminal-set semantics are known a priori. ## Core Distinction The A2A v1.0 task lifecycle is specified as a *partial order with vendor-extension latitude*, not a closed enum. The spec fixes the canonical states and their legal edges, but `AgentCapabilities` and the unconstrained `metadata` field on `AgentCard` let each vendor publish additional terminal states, additional `input-required` subtypes, and — critically — a *different terminal set* than the canonical `{completed, failed, canceled}`. The distinction that matters operationally is between **transition legality** (is `working → completed` an edge in the local state machine?) and **transition conformance** (does the peer's advertised card agree that `completed` is terminal *for this skill*, and will it never subsequently emit `working` for the same `taskId`?). A transition can be perfectly legal against the canonical machine and still be non-conformant against the negotiated card. The failure mode is that most orchestrators validate the former and assume the latter. ## What Was Observed During a cross-vendor fan-out (orchestrator → three peer agents: vendor A canonical, vendor B with a custom `input-required` refinement, vendor C publishing a non-canonical terminal state `deferred`), the following trace was captured on a single `taskId`: ``` t0 orchestrator → A SendTask(taskId=T1) t1 A → orchestrator TaskStatusUpdate(T1, state=working) t2 orchestrator → B SendTask(taskId=T2) t3 B → orchestrator TaskStatusUpdate(T2, state=input-required, metadata={"reason":"clarification","subtype":"ambiguous-arg"}) t4 orchestrator → B SendTask(taskId=T2, message=) # resume t5 B → orchestrator TaskStatusUpdate(T2, state=working) t6 C → orchestrator TaskStatusUpdate(T3, state=deferred, metadata={"retryable":true,"reemitAfterMs":30000}) t7 orchestrator local machine: state(T3)=working (deferred unrecognized, coerced to working by default branch) t8 C → orchestrator TaskStatusUpdate(T3, state=completed) # 31s later t9 orchestrator local machine: working → completed OK, but T3 was ALSO counted against the 30s task deadline at t7→t8 because coercion reset the deadline clock. ``` Two distinct defects surfaced. First, at `t6` the orchestrator's state machine had no edge for `deferred`; its `default:` branch silently coerced the unknown state to `working`, discarding the `retryable` and `reemitAfterMs` metadata. Second, at `t7` this coercion reset the per-task deadline, so the legitimate 30s vendor-C backoff was charged against the orchestrator's own timeout budget rather than paused. The task at `t9` completed correctly in vendor C's view but the orchestrator had already logged a spurious `deadline_exceeded` and, in a second run, *canceled* T3 at t7+30s — sending `TaskStatusUpdate(state=canceled)` to C for a task C still considered live. C then emitted `completed` for a canceled task, producing a terminal-terminal conflict the orchestrator had no reconciliation rule for. The root cause is not the unknown state. It is that the orchestrator treated the *canonical* terminal set as authoritative and the *card-advertised* terminal set as advisory. Vendor C's card had in fact declared `deferred` under `capabilities.extensions` with `"terminal": false, "resumable": true` — the orchestrator parsed the card, validated its JSON schema, and then discarded the extension block because its state machine had no representation for it. ## Condition of Validity The invariant that was violated: **for any `taskId`, the orchestrator's local terminal-set and deadline-clock behavior must be derived from the intersection of (a) the canonical A2A v1.0 machine and (b) the peer card's declared extensions, and any state not present in that intersection must be treated as `input-required`-equivalent (a *pause*, not a progress or a reset), never coerced to `working`.** This holds only under three preconditions, and the article's guidance is void outside them: 1. The peer card was successfully fetched and schema-validated *before* the first `SendTask` for that peer. If the card is fetched lazily or fails to validate, you have no basis for extension-aware handling and must fall back to canonical-only with a hard `unrecognized_state` failure rather than coercion. 2. The card's `capabilities.extensions` block is treated as part of the negotiation contract, not decoration. An extension the orchestrator cannot interpret is a *capability mismatch*, and per A2A v1.0 the correct response is to omit the corresponding skill from dispatch, not to dispatch and hope. 3. The deadline clock is a function of *observed peer progress*, not of local state-machine transitions. A coerced transition is not progress. Where these preconditions fail — dynamic card discovery mid-task, cards that mutate their extension block between fetches, or peers that emit states absent from their own advertised card — the only sound behavior is to fail the task closed with an explicit conformance error, because you can no longer reason about the terminal set. ## Decision Boundary The boundary is between **coerce-and-continue** and **halt-on-conformance-gap**. Coercion is defensible only when the unknown state is provably a refinement of a canonical state the orchestrator already handles *and* the card declares it non-terminal. Concretely: - Unknown state, card declares `terminal: false` and `resumable: true` → map to `input-required` semantics: pause the deadline clock, do not advance the state machine, wait for the next update or the declared `reemitAfterMs`. This is the `deferred` case and is the *only* case where continuing is correct. - Unknown state, card declares `terminal: true` → treat as a terminal state but one the orchestrator cannot classify as success or failure; route to a human/auditor queue. Do **not** map to `completed` or `failed`. - Unknown state, card silent on the extension (state emitted but not advertised) → conformance violation by the peer; halt the task, emit `canceled` with `metadata.reason="unadvertised_state"`, and quarantine the peer card pending re-fetch. - Canonical state arriving after a locally-terminal state (the `canceled`-then-`completed` conflict at t9) → the *first* terminal wins for accounting, but the conflict is logged as a `terminal_conflict` and the task is flagged non-idempotent. A2A does not specify terminal-terminal reconciliation; you must, or you will double-count. The decision must be made per-update against the card snapshot pinned at task creation, not against the live card, or a mid-task card mutation silently changes the rules under a running task. ## Operational Effect The practical consequence of getting this wrong is not a crash — it is silent accounting drift. In the observed run, coerced `deferred → working` inflated the orchestrator's "active tasks" gauge, charged a vendor's legitimate backoff against the orchestrator's SLA budget, and produced a `canceled`-then-`completed` terminal conflict that the reconciliation layer resolved by *dropping the completed result entirely* (first-terminal-wins, no merge). The user-visible effect was a task that vendor C reported as succeeded and the orchestrator reported as canceled, with the result payload orphaned. The guardrail is a pinned-card state machine: at `SendTask` time, compile the peer's card into a per-task transition table whose terminal set and resumable set are the card's, not the canonical enum's; any update whose state is absent from that table raises a conformance error rather than hitting a `default:` branch. Deadline clocks key off `working`-with-progress events, never off state-machine writes, so a pause cannot be mistaken for a reset. And terminal-terminal conflicts must be an explicit, logged, non-silent event with a defined winner — because A2A v1.0 leaves that resolution to you, and the default of "whatever arrived first" is how results get dropped. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Mapping class ConformanceError(RuntimeError): """Raised when a peer emits a task state not derivable from its pinned card.""" class CanonicalState(str, Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" CANONICAL_TERMINAL = frozenset( {CanonicalState.COMPLETED, CanonicalState.FAILED, CanonicalState.CANCELED} ) @dataclass(frozen=True) class Extension: name: str terminal: bool resumable: bool reemit_after_ms: int | None = None @dataclass(frozen=True) class PinnedCard: """Card snapshot captured at SendTask time; never re-read mid-task.""" peer_id: str extensions: Mapping[str, Extension] = field(default_factory=dict) def classify(self, state: str) -> tuple[str, bool, bool, int | None]: """Return (kind, terminal, resumable, reemit_ms) or raise.""" if state in {s.value for s in CanonicalState}: return ("canonical", state in {s.value for s in CANONICAL_TERMINAL}, False, None) ext = self.extensions.get(state) if ext is None: raise ConformanceError( f"peer {self.peer_id} emitted unadvertised state {state!r}" ) return ("extension", ext.terminal, ext.resumable, ext.reemit_after_ms) @dataclass class TaskMachine: task_id: str card: PinnedCard state: str = CanonicalState.SUBMITTED.value terminal_seen: str | None = None deadline_paused: bool = False def apply(self, incoming: str) -> str: kind, terminal, resumable, reemit_ms = self.card.classify(incoming) if self.terminal_seen is not None: if terminal: raise ConformanceError( f"task {self.task_id}: terminal-terminal conflict " f"{self.terminal_seen!r} then {incoming!r}" ) # non-terminal arriving after terminal: ignore, but surface it return self.state if kind == "extension" and resumable and not terminal: # pause semantics: do NOT advance state, do NOT reset deadline self.deadline_paused = True return self.state if terminal: self.terminal_seen = incoming self.state = incoming self.deadline_paused = False return self.state def drive(machine: TaskMachine, updates: list[str]) -> str: for u in updates: machine.apply(u) if machine.terminal_seen is None: raise ConformanceError( f"task {machine.task_id} exhausted updates without reaching a " f"terminal state declared by card {machine.card.peer_id!r}" ) return machine.terminal_seen # Observed vendor-C trace: deferred is advertised, resumable, non-terminal. card_c = PinnedCard( peer_id="vendor-c", extensions={"deferred": Extension("deferred", terminal=False, resumable=True, reemit_after_ms=30000)}, ) m = TaskMachine(task_id="T3", card=card_c) assert drive(m, ["working", "deferred", "completed"]) == "completed" assert m.deadline_paused is False # Unadvertised state must fail closed, not coerce. try: drive(TaskMachine(task_id="T4", card=PinnedCard(peer_id="vendor-x")), ["working", "deferred"]) except ConformanceError as e: assert "unadvertised state" in str(e) else: raise ConformanceError("coercion path was taken for an unadvertised state") ```