# How should an instance treat a task whose Agent Card advertises a `taskState` it can no longer legally transition into **Date of Record:** 2026 November 23 **Scope:** Applies to A2A v1.0 peers that discover capabilities via Agent Card and drive a task lifecycle across a trust boundary where artifacts are signed. Does not apply to intra-process or single-trust-domain calls where the Card and the runtime share a deployment and a signing key. ## Core Distinction A2A Agent Cards are *advertisements*, not *contracts*. The Card declares the `taskState` values an agent claims to support and the transitions it claims to honor. Discovery treats that declaration as authoritative for routing. But the Card is fetched once (or cached with a TTL), while the task state machine is evaluated at every transition, under whatever policy the remote agent actually enforces *now*. **A Card can remain structurally valid, signature-valid, and unexpired while advertising transitions the remote agent will refuse to execute.** Card validity and transition legality are orthogonal invariants. Conflating them produces the classic failure: the caller believes `input-required → working` is reachable because the Card lists both states, sends the required input, and receives a signed rejection artifact referencing a state the caller's local machine never modeled. Operationally: *Card-declared state set* ≠ *reachable transition set*. The Card tells you which states exist; it does not tell you which edges are currently armed. ## What Was Observed During cross-org exchange between two A2A v1.0 agents, a task reached `input-required`. The caller's discovery cache held a signed Card (valid 24h) declaring `capabilities.taskStates: [submitted, working, input-required, completed, failed, canceled]`. The caller supplied the requested input and issued a transition to `working`. The remote agent — since Card issuance entered a degraded mode accepting only `input-required → canceled` (a maintenance drain not reflected in the Card) — returned a signed artifact with `taskState: canceled`, reason `state_transition_refused`. The caller's state machine had no `input-required → canceled` edge. It treated the signed artifact as malformed, retried the `working` transition three times, then escalated. The artifact was *cryptographically valid* and *semantically legal on the remote side*. The failure was purely a mismatch between advertised and enforced transition graphs. No signature check, Card expiry check, or schema validation could have caught it, because every individual component was correct. ## Condition of Validity The invariant "a task can be driven to `completed` iff the Card advertises the needed states" holds only when all of the following are simultaneously true: 1. The remote agent enforces exactly the transition graph implied by its Card's state list (no drain modes, no policy overrides, no per-tenant gating). 2. The Card is re-fetched at task initiation, not reused from a cache populated before the task began. 3. The caller's local state machine is a *superset* of the remote's enforced graph, so any legal remote transition has a legal local edge. Any one failing breaks the invariant. Condition 1 fails routinely (maintenance drains, quota gating, mid-task trust-tier downgrades). Condition 3 fails because callers typically model only the happy path plus failure edges, omitting terminal transitions reachable from intermediate states. ## Decision Boundary When a signed artifact arrives whose `taskState` does not correspond to a legal edge from the caller's current local state: - **Do not** treat it as malformed or retry the original transition. Retrying a refused transition against a draining agent amplifies load and can trip rate limits. - **Do** verify the artifact signature first (ground truth that the remote really emitted this state). - **Do** re-fetch the Agent Card once, bounded, to check whether the advertised graph changed. If it did, adopt the new graph. - **Do** accept the remote's terminal state as authoritative for *the remote's view* even if the local machine never modeled the edge — but record the divergence, because silent acceptance hides the bug. - **Do not** treat the remote's `canceled` as equivalent to a local `failed`. They carry different retry semantics and artifact-retention obligations. The boundary rule: **transition legality is decided by the remote's enforced machine at emission time, not by the Card at discovery time.** The Card informs routing; the signed artifact decides truth. ## Operational Effect Callers that model the full transition graph as a superset (including `input-required → canceled`, `working → canceled`, `submitted → rejected`) and that re-fetch Cards on any unmodeled-edge event survive remote drains without escalation. Callers that treat the Card as a contract and the local machine as complete will retry into refusals, escalate on what is actually a clean cancellation, and — worst — misclassify a signed `canceled` as a corrupt artifact, discarding a valid signature and losing the audit trail. The observable effect is a spike in false "malformed artifact" alarms correlated with remote maintenance windows, easily misdiagnosed as a signing bug. ```python class UnmodeledTransitionError(RuntimeError): """Raised when a signed artifact's taskState has no legal edge from the caller's current local state, and the re-fetched Agent Card does not legitimize it either.""" pass # Caller's local machine: state -> set of legal successor states. # Deliberately a superset of the happy path to absorb remote drains. LEGAL_EDGES = { "submitted": {"working", "rejected", "canceled"}, "working": {"input-required", "completed", "failed", "canceled"}, "input-required": {"working", "canceled", "failed"}, "completed": set(), "failed": set(), "canceled": set(), "rejected": set(), } def apply_signed_artifact(local_state: str, artifact: dict, refetch_card) -> str: """Apply a signature-verified artifact. Returns the new local state. Signature verification is assumed to have happened upstream; this function enforces transition legality and Card re-fetch policy. """ remote_state = artifact.get("taskState") if remote_state is None: raise UnmodeledTransitionError("artifact missing taskState field") if remote_state in LEGAL_EDGES.get(local_state, set()): return remote_state # Unmodeled edge. Re-fetch the Card once (bounded) to see if the # advertised graph changed since discovery. card = refetch_card() advertised = set(card.get("capabilities", {}).get("taskStates", [])) if remote_state in advertised and remote_state in LEGAL_EDGES.get(local_state, set()): # Card was stale; adopt the newly advertised edge. return remote_state # Remote emitted a state we cannot legally reach from here, and the # refreshed Card does not legitimize it. Do NOT retry the refused # transition. Surface for human/agent escalation with full context. raise UnmodeledTransitionError( f"remote emitted taskState={remote_state!r} from local_state={local_state!r}; " f"advertised={sorted(advertised)}; refusing to retry refused transition" ) ```