# What structural signals indicate an A2A v1.0 task-lifecycle divergence at the vendor boundary: the `input-required` ↔ `working` re-entry race and its card-declared capability blind spot **Date of Record:** 2026 December 3 **Scope:** Applies to cross-vendor A2A v1.0 task exchanges where a remote agent (server) drives a task through `submitted → working → input-required → working → completed` and the local agent (client) replays or resumes against a cached Agent Card. Does not apply to single-vendor intra-process calls, nor to synchronous request/response MCP tool invocations without a task lifecycle. ## Core Distinction The failure is not "the remote agent returned an error." It is that **the A2A v1.0 Agent Card declares a *capability surface* (`capabilities.streaming`, `capabilities.pushNotifications`, declared `skills[].inputModes/outputModes`) but does not declare the *transition legality graph* of its task state machine.** Two conformant vendors can both advertise `capabilities.streaming: true` and identical skill schemas, yet disagree on whether a task in `input-required` may legally transition back to `working` on a `tasks/send` follow-up without first passing through an explicit `tasks/resubscribe`, or whether a client-side `tasks/get` poll during that window must return `input-required` or `working`. Concretely: the divergence is observable only when the client re-enters a task that the server has *already* advanced. The structural signal is a **state monotonicity violation** — the server returns a task whose `status.state` is *earlier* in the client's local model than the last state the client observed, or the server returns `working` for a task the client believes is parked in `input-required` and awaiting its input. Both are legal under the spec's permissive `TaskState` enum; neither is illegal under any vendor's conformance suite, because the suites test transitions in isolation, not the re-entry edge. ## What Was Observed A client agent (Vendor A) submitted a task to a Vendor B remote agent with `tasks/send`. Sequence, reconstructed from the client's event log: 1. `t0` — client sends `tasks/send` with `message` containing the initial instruction. Server replies `status.state = "submitted"`, `id = task-7f2`. 2. `t1` — client polls `tasks/get`. Server returns `status.state = "working"`. 3. `t2` — client polls again. Server returns `status.state = "input-required"` with `status.message` asking for a missing parameter (`region`). Client caches `task-7f2 → input-required`, pauses its loop, and surfaces the question to its own caller. 4. `t3` (+41s) — client's caller supplies `region=eu-west-1`. Client sends `tasks/send` with `id = task-7f2` and a `message` carrying the parameter. 5. `t4` — **divergence.** Vendor B's server, on receipt of the follow-up, internally transitions `input-required → working` and *also* asynchronously re-emits the original `input-required` status via its push-notification channel (configured at `t0`). The client receives the push notification *after* the `tasks/send` response and overwrites its local state back to `input-required`, then — per its own state machine — refuses to poll a task it believes is waiting on *it*, and stalls. 6. `t5` (+300s) — client's task watchdog fires. The task is abandoned with `status.state = "canceled"` locally, but Vendor B's task is still `working` and will eventually `completed`, orphaned. The structural signals that preceded the stall, in order of diagnostic value: - **Signal 1 — non-monotonic push re-emission.** A push notification arrived carrying a `status.state` the client had already superseded via a direct `tasks/get`/`tasks/send` response. A2A v1.0 §7.4 constrains push payloads to the current task state but does not forbid a *stale* push racing a fresher synchronous reply. The client had no `status.timestamp` comparison guard. - **Signal 2 — card capability/skill mismatch under re-entry.** Vendor B's Agent Card declared `capabilities.pushNotifications: true` and a skill with `inputModes: ["text/plain"]`, but did not declare whether `input-required` re-entry is *resumable via `tasks/send` with same id* or requires `tasks/resubscribe`. Vendor A's client assumed the former (the common case); Vendor B's conformance suite only tested the latter. - **Signal 3 — absent `status.timestamp` on the divergent push.** The push payload omitted `status.timestamp` (legal — it is `OPTIONAL` in the schema), so the client could not order the push against its cached synchronous state even if it had tried. The re-entry edge is the failure locus. Every individual message is conformant. The *composition* across vendors is not. ## Condition of Validity This divergence is only reachable when **all** of the following hold simultaneously; remove any one and the race collapses: 1. The task has entered `input-required` at least once (so the client has parked state and is waiting on an external input). 2. The remote agent has push notifications enabled **and** the client has registered a webhook — because the stale-push race requires two channels (synchronous reply + async push) carrying the same task. 3. The client resumes via `tasks/send` with the same `id` rather than `tasks/resubscribe` — i.e., the client treats the task as a *sendable* task, which is the documented A2A v1.0 pattern for supplying `input-required` data. 4. The remote agent's push channel does not carry `status.timestamp`, or carries it but the client does not compare it against its cached state's timestamp before applying. 5. The remote agent's conformance suite does not exercise the `input-required → working` transition *while a push is in flight* — which is the default for every vendor suite we have inspected, because the suites are transition-isolated. If the client uses `tasks/resubscribe` (which re-attaches to the SSE stream and is defined to yield the *current* state first), the race is bounded: the stream's first event is authoritative and the client can discard any push older than stream-attach. If the remote agent timestamps every push, the client can order events and drop the stale one. If push is disabled, there is one channel and no race. **The condition of validity is therefore: two-channel delivery + unmarked re-entry + no timestamp ordering.** That is the exact window. ## Decision Boundary The architectural invariant that must be enforced client-side is **state monotonicity per task id, with a channel-precedence rule**: - On any inbound state for `task-7f2`, the client compares the incoming `(status.state, status.timestamp)` against its cached `(state, timestamp)`. - If the incoming state is *earlier* than the cached state in the client's local transition order (e.g., cached `working`, incoming `input-required`), the client **discards** the inbound event and logs a `non-monotonic-state` signal — it does not overwrite. - If timestamps are present, the newer timestamp wins regardless of state order (handles legitimate server-side re-entry, e.g., a server that genuinely re-parks a task in `input-required` after a failed sub-step — this is legal and must not be discarded). - If timestamps are absent, the client **must** prefer the synchronous `tasks/send`/`tasks/get` reply over any push, because the synchronous reply is causally downstream of the client's own request and the push may be a re-emission of a pre-request state. - The client must **never** transition its local task out of `working` based solely on a push that arrives within the same request/response window as a `tasks/send` it issued. The boundary is sharp: below it (monotonic, timestamped, or single-channel), the naive "last write wins" client is correct and simpler. Above it (two-channel, unmarked, untimestamped re-entry), "last write wins" is *wrong* — it will stall the task — and the monotonicity guard is mandatory. The second invariant is **card-declared re-entry semantics**. A2A v1.0 Agent Cards do not carry a `taskStateMachine` field, so the client cannot read the server's transition legality graph. The operational workaround is to treat the *absence* of a `capabilities.pushNotifications` + `tasks/resubscribe` pairing as a signal that re-entry is `tasks/send`-based and therefore subject to the race — and to require timestamped pushes as a precondition for enabling push on any remote agent whose card does not declare re-entry semantics. Vendors that ship a `x-task-state-machine` extension (some do) are exempt; vendors that do not are not. ## Operational Effect The observable effect of getting this wrong is a **silent task orphan**: the client believes it is waiting on its caller; the server believes it is working; neither errors; the task times out on the client side and completes on the server side, and the result is never collected. In our incident, the orphaned task produced a valid `completed` artifact at `t5 + 220s` that the client never read, and the client's caller received a `canceled` status for a task that in fact succeeded. Downstream, the caller's retry logic re-submitted the same instruction under a fresh task id, causing a duplicate side effect at the remote vendor (a provisioning call) — the classic at-least-once amplification that follows an orphan. The fix is cheap and local: a per-task `(state, timestamp)` cache, a discard-on-non-monotonic rule, and a channel-precedence rule that prefers synchronous replies over pushes within the request window. The cost of *not* having it is a class of failures that no conformance suite catches, because the suites test transitions, not the re-entry edge, and because the Agent Card — the only cross-vendor contract surface — does not describe the state machine it is supposed to govern. ```python from __future__ import annotations from dataclasses import dataclass from datetime import datetime, timezone from enum import IntEnum from typing import Optional class NonMonotonicStateError(RuntimeError): """Raised when an inbound task state regresses without a newer timestamp.""" class TaskState(IntEnum): # Local ordering used only to detect regressions; NOT the A2A wire enum. SUBMITTED = 0 WORKING = 1 INPUT_REQUIRED = 2 COMPLETED = 3 CANCELED = 4 FAILED = 5 @dataclass(frozen=True) class TaskStatus: state: TaskState timestamp: Optional[datetime] # None == legal-but-unorderable per A2A v1.0 source: str # "sync" | "push" class MonotonicTaskCache: """Enforces per-task state monotonicity with channel precedence. Invariant: a state may only move forward, OR move backward iff the inbound carries a strictly newer timestamp than the cached one. Absent timestamps, synchronous replies outrank pushes. """ def __init__(self) -> None: self._cache: dict[str, TaskStatus] = {} def apply(self, task_id: str, incoming: TaskStatus) -> TaskStatus: cached = self._cache.get(task_id) if cached is None: self._cache[task_id] = incoming return incoming # Rule 1: timestamped events are ordered by time, regardless of state order. if incoming.timestamp is not None and cached.timestamp is not None: if incoming.timestamp > cached.timestamp: self._cache[task_id] = incoming return incoming # Older-or-equal timestamp: always discard, even if state is "later". return cached # Rule 2: untimestamped push within a request window loses to sync. if incoming.timestamp is None and cached.source == "sync" and incoming.source == "push": return cached # Rule 3: untimestamped regression is a divergence -> hard fail, do not apply. if incoming.state < cached.state: raise NonMonotonicStateError( f"task {task_id}: inbound {incoming.state.name} regresses cached " f"{cached.state.name} with no newer timestamp (source={incoming.source})" ) # Rule 4: forward or equal untimestamped move is accepted. self._cache[task_id] = incoming return incoming def handle_inbound_push( cache: MonotonicTaskCache, task_id: str, wire_state: str, timestamp: Optional[datetime], ) -> TaskStatus: """Entry point for a push-notification webhook payload.""" try: state = TaskState[wire_state.upper().replace("-", "_")] except KeyError as exc: raise NonMonotonicStateError(f"unknown A2A TaskState {wire_state!r}") from exc incoming = TaskStatus(state=state, timestamp=timestamp, source="push") return cache.apply(task_id, incoming) # --- Reproducing the incident trace ----------------------------------------- if __name__ == "__main__": cache = MonotonicTaskCache() t0 = datetime(2026, 4, 24, 12, 0, 0, tzinfo=timezone.utc) # t1: sync poll -> working cache.apply("task-7f2", TaskStatus(TaskState.WORKING, t0, "sync")) # t2: sync poll -> input-required cache.apply("task-7f2", TaskStatus(TaskState.INPUT_REQUIRED, t0, "sync")) # t3: client sends region -> sync reply working cache.apply("task-7f2", TaskStatus(TaskState.WORKING, t0, "sync")) # t4: stale push re-emits input-required with NO timestamp -> must be discarded, # not treated as a legal re-entry. Without the guard this stalls the task. result = handle_inbound_push(cache, "task-7f2", "input-required", timestamp=None) assert result.state == TaskState.WORKING, "stale push must not regress state" # A genuinely newer timestamped re-entry IS legal and must be accepted. t_later = datetime(2026, 4, 24, 12, 0, 5, tzinfo=timezone.utc) reentered = handle_inbound_push(cache, "task-7f2", "input-required", timestamp=t_later) assert reentered.state == TaskState.INPUT_REQUIRED # An untimestamped regression with no sync precedence still raises. try: cache.apply("task-7f2", TaskStatus(TaskState.WORKING, None, "push")) except NonMonotonicStateError as exc: print(f"guard fired as designed: {exc}") ```