# Why does an instance enter `input-required` after a terminal `completed` transition in A2A v1.0 cross-vendor agent card negotiation **Date of Record:** 2026 November 23 **Scope:** Applies to A2A v1.0 task lifecycle transitions when a client agent negotiates an Agent Card with a peer whose declared `capabilities.streaming` and `capabilities.pushNotifications` differ from the client's cached card, and where the peer subsequently emits a non-terminal state after a terminal one. Does not apply to single-vendor same-card deployments or to tasks that never crossed a vendor boundary. ## Core Distinction **Task state** is a monotonic, per-task resource governed by the A2A task lifecycle state machine; `completed`, `failed`, and `canceled` are absorbing. **Negotiation state** is a per-connection, per-card artifact of Agent Card exchange and is *not* absorbing — a peer may rotate its advertised card mid-task. When an implementation conflates the two, a card renegotiation arriving *after* a terminal task transition can be misapplied to the task, resurrecting it into `input-required`. This is not a server-side spec violation; it is a client-side merge error writing the negotiation delta into the task record. ## What Was Observed During a cross-vendor run (client on vendor A's SDK, remote agent on vendor B's runtime): 1. Client submits task `T-8842` with `message/send`. 2. Remote returns `working`, then `completed` with an artifact. 3. Client caches the remote's Agent Card (version `1.0.3`, `streaming: true`). 4. Remote rotates its card to `1.0.4`, pushing an update via the `agent-card` channel: `streaming` becomes `false`, and a `pushNotifications` requirement is added. 5. Client's card-merge handler detects a capability mismatch against the in-flight *connection* and emits a `TaskStatusUpdateEvent` with `state: input-required`, asking the user to reauthorize push notifications. 6. The task record now shows `completed → input-required`, violating the absorbing-state invariant. Root cause: the card-merge handler did not check whether the associated task had reached a terminal state before writing the negotiation delta. In vendor A's SDK, `TaskManager.applyCardUpdate()` writes the new status unconditionally; the terminal-state guard exists only in `TaskManager.transition()`, which the card path bypasses. ## Condition of Validity Reachable only when all of the following hold: - The peer is cross-vendor (card schema drift is plausible; same-vendor cards are versioned in lockstep). - The client caches the card at task-submit time rather than re-fetching per transition. - The peer's card rotation changes a capability field (`streaming`, `pushNotifications`, or `extensions`) that the client's merge logic maps to a task-level state. - The task has already reached `completed`, `failed`, or `canceled` before the card update is processed. If the client re-fetches the card per transition, the update arrives *before* the terminal transition and is absorbed harmlessly. If the peer never rotates cards mid-flight, the path is dead. The violation is a *race between card rotation latency and task terminality*, not a general A2A defect. ## Decision Boundary **Card-negotiation state MUST NOT be written into a task record whose current state is terminal.** A terminal task is immutable except for `artifacts` append (which A2A permits) and `metadata` annotation. Any capability delta from a rotated card must be applied to the *connection* or to *future tasks*, never to a terminal task's `status`. The boundary is sharp: `working` and `input-required` tasks may accept a card-driven status correction (e.g., a peer that lost streaming mid-task legitimately re-enters `input-required` to renegotiate transport). `completed`, `failed`, and `canceled` may not. Guarding on "is the task still open" gets this right; guarding on "did the card change" gets it wrong. ## Operational Effect Left unguarded, the effect is a *resurrected task*: downstream consumers polling for terminal state see a task flip back to `input-required`, triggering duplicate human reauthorization prompts, duplicate artifact regeneration on the next `completed`, and — in billing pipelines that meter on terminal transitions — double-counting. The failure is silent in logs unless the terminal transition is logged with a monotonic sequence number; most SDKs log state *changes* without ordering guarantees, so the resurrection appears as a normal transition. The mitigation is a terminality guard on the card-merge path, plus a monotonic `statusSequence` field compared before write. The following guard encodes the invariant and raises when a card update attempts to write a non-terminal state onto a terminal task. ```python from __future__ import annotations from dataclasses import dataclass from enum import Enum class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" TERMINAL_STATES = frozenset({TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED}) class TerminalStateResurrectionError(RuntimeError): """Raised when a card-negotiation delta attempts to write a non-terminal state onto a task that has already reached an absorbing terminal state.""" @dataclass(frozen=True) class TaskRecord: task_id: str state: TaskState status_sequence: int card_version: str @dataclass(frozen=True) class CardUpdate: card_version: str requested_state: TaskState reason: str def apply_card_update(task: TaskRecord, update: CardUpdate) -> TaskRecord: """Merge a rotated Agent Card's capability delta into a task record. Invariant: a terminal task's state is absorbing. Card negotiation may annotate metadata or affect future tasks, but MUST NOT rewrite status. """ if task.state in TERMINAL_STATES and update.requested_state not in TERMINAL_STATES: raise TerminalStateResurrectionError( f"task {task.task_id} is terminal ({task.state.value}); " f"card {update.card_version} attempted to write " f"{update.requested_state.value} (reason: {update.reason})" ) if update.requested_state == task.state: # Idempotent card refresh; bump sequence only. return TaskRecord( task_id=task.task_id, state=task.state, status_sequence=task.status_sequence + 1, card_version=update.card_version, ) return TaskRecord( task_id=task.task_id, state=update.requested_state, status_sequence=task.status_sequence + 1, card_version=update.card_version, ) def negotiate_card_mid_task(task: TaskRecord, update: CardUpdate) -> TaskRecord: """Entry point used by the SDK card-merge handler. Guards against the cross-vendor race where a rotated card arrives after the task has already completed. If the task is terminal, we refuse the state write and surface the error to the caller so the update can be routed to the connection layer instead. """ if task.state in TERMINAL_STATES: # Route to connection-scoped handling; never mutate the task. raise TerminalStateResurrectionError( f"refusing card-driven transition on terminal task {task.task_id} " f"(state={task.state.value}, card={update.card_version}); " f"apply delta to connection scope instead" ) return apply_card_update(task, update) ```