# What structural signals indicate a dead A2A task: the `input-required` → `canceled` callback race in v1.0 lifecycle negotiation **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 agents that expose `tasks/pushNotificationConfig` callbacks and negotiate task lifecycle through `TaskState` transitions (`submitted`, `working`, `input-required`, `completed`, `canceled`, `failed`). Does not cover synchronous `message/send` request-reply flows without push callbacks, nor A2A v0.x agents that predate the `input-required` state. ## Core Distinction The failure is not "a callback was lost." The failure is that a *terminal* state (`canceled`) and a *non-terminal, resumable* state (`input-required`) can be published concurrently by two parties — the remote task executor and the local orchestrator's cancellation policy — and A2A v1.0's task lifecycle is a partial order, not a total order. The agent-card advertises `capabilities.pushNotifications: true` and a `defaultInputModes`, but it does *not* advertise whether the server treats `input-required` as a latch (must be resumed or explicitly canceled) or as a yield point (server may self-cancel on TTL). That single unadvertised semantic is the boundary condition. When an orchestrator issues `tasks/cancel` while the remote agent has just transitioned to `input-required` to request a clarifying slot, both transitions are individually legal. The callback contract then delivers two push notifications whose ordering is not guaranteed by the spec, and the orchestrator's state machine has no rule for which wins. ## What Was Observed A discovery-and-dispatch pipeline resolved an agent card from `/.well-known/agent.json`. The card declared: - `capabilities.pushNotifications: true` - `defaultInputModes: ["text/plain"]` - `skills[].inputModes` omitting `application/json` The orchestrator dispatched a task whose first tool call needed a JSON-schema-shaped argument. The remote executor accepted `tasks/send`, entered `working`, executed one tool call, then transitioned to `input-required` with a `status.message` requesting the missing structured field. Because the orchestrator had a 90-second wall-clock budget and a cancellation policy keyed on `working` exceeding 60s, it fired `tasks/cancel` at t=61s. The remote executor, which had its own 120s `input-required` TTL, received the cancel at t=61.2s and transitioned to `canceled`, emitting a push notification. At t=61.4s the orchestrator's own TTL timer for the `input-required` state fired and it emitted a *local* `canceled` record. At t=61.5s the remote's push notification for `input-required` (queued behind a retry backoff from an earlier 503 on the callback endpoint) arrived *after* the `canceled` notification. The orchestrator's reducer applied events in arrival order: `canceled` then `input-required`. Its lifecycle guard rejected the second as an illegal transition from a terminal state and dropped it — but it had already deleted the task's resume token, so the later-arriving `input-required` payload (which contained the exact field the executor needed) was unrecoverable. The task was reported as `canceled` with no artifact, while the remote had actually been waiting, resumable, for 0.3s before honoring the cancel. The observable signature was a **terminal-state callback arriving before a non-terminal callback that was published earlier in remote logical time**. Sequence numbers, if present, were per-notification and not monotonic across the two publishers. ## Condition of Validity This analysis holds only when all of the following are true; otherwise the race does not manifest: 1. The agent card advertises `pushNotifications: true` **and** the `input-required` state is reachable (i.e., the skill's `inputModes` do not fully cover the inputs the task will require — a discovery-time capability/schema mismatch is the *precondition*, not the bug). 2. The orchestrator maintains a local cancellation policy with a timer independent of the remote task's TTL. If cancellation is purely remote-driven, there is one publisher and no race. 3. Callback delivery is at-least-once with retry backoff (the spec permits this), so notification arrival order is not equal to publication order. 4. The orchestrator's reducer treats `canceled` as absorbing (terminal) and drops subsequent events. If it buffers late events, the race degrades to a latency bug rather than data loss. If the card omits `pushNotifications` or the skill's `inputModes` are a superset of the task's needs, the precondition fails and the task never enters `input-required`. If the orchestrator has no independent timer, there is no concurrent terminal publisher. ## Decision Boundary The invariant required to bound this race is: **a terminal state may only be committed by a party that holds the current task lease, and a non-terminal state transition observed after lease loss must be treated as a resume offer, not an illegal transition.** Operationally this decomposes into three guards: - **Lease fencing on the task, not the transport.** Every `tasks/cancel` and every local terminal commit must carry the `taskId` plus the last-seen `status.timestamp` (or a server-issued `status.sequence` if the card advertises one). A terminal commit whose fence is older than an observed `input-required` timestamp is rejected and the task is re-opened. - **Capability-gap check at discovery.** Before dispatch, intersect the task's required input schema against `skills[].inputModes` and `defaultInputModes`. If the task needs a mode the card does not advertise, the orchestrator must either request the missing field up front (avoiding `input-required` entirely) or register a resume handler *before* the first `working` transition. This converts a runtime race into a dispatch-time rejection. - **Callback ordering buffer with terminal quarantine.** Push notifications are applied through a reorder window keyed on `status.timestamp`; a terminal event is held in quarantine for one reorder window (or until a higher-timestamp non-terminal event is ruled out) before the resume token is deleted. The token deletion is the irreversible step and must be the last action, gated on the quarantine draining. The boundary is sharp: if the orchestrator can prove no non-terminal event with a later timestamp exists, it may commit terminal immediately. If it cannot prove that (callback delivery is at-least-once and unordered), it must quarantine. There is no middle ground that preserves the resume token without a reorder window. ## Operational Effect Without the guards, the observed effect is silent task loss: the orchestrator reports `canceled` with no artifact, the remote executor reports `canceled` after briefly holding a resumable `input-required`, and neither party's logs show an error — both transitions were legal. The failure is invisible to retry logic because the task is terminal on both sides. With lease fencing, the late `input-required` re-opens the task and the orchestrator resumes with the field the executor requested, at the cost of one extra round trip and a bounded quarantine delay (typically one callback retry backoff, ~1–5s). With the discovery-time capability-gap check, the `input-required` state is never entered for schema-mismatch reasons, eliminating the race for the most common trigger. The residual cost is that orchestrators must now model `input-required` as a *resumable terminal-adjacent* state and cannot treat any single terminal callback as authoritative until the reorder window drains — a change to the reducer's absorbing-state assumption, not to the transport. ```python from dataclasses import dataclass from enum import Enum from typing import Optional class LifecycleRaceError(RuntimeError): """Raised when a terminal commit would clobber a later-timestamped non-terminal state.""" class TaskState(Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" COMPLETED = "completed" CANCELED = "canceled" FAILED = "failed" TERMINAL = {TaskState.COMPLETED, TaskState.CANCELED, TaskState.FAILED} @dataclass class StatusEvent: task_id: str state: TaskState timestamp: float # remote logical time, from status.timestamp resume_token: Optional[str] = None class TaskReducer: def __init__(self, reorder_window: float = 5.0): self.reorder_window = reorder_window self.last_seen: dict[str, StatusEvent] = {} self.quarantine: dict[str, StatusEvent] = {} self.committed_terminal: dict[str, StatusEvent] = {} def apply(self, ev: StatusEvent) -> None: prev = self.last_seen.get(ev.task_id) if prev is not None and ev.timestamp < prev.timestamp: # out-of-order arrival; buffer, do not apply self.quarantine[ev.task_id] = ev return if ev.state in TERMINAL: # hold terminal in quarantine; do not delete resume token yet self.quarantine[ev.task_id] = ev self._try_commit_terminal(ev.task_id) else: # non-terminal observed: re-open if a terminal was provisionally committed if ev.task_id in self.committed_terminal: del self.committed_terminal[ev.task_id] self.last_seen[ev.task_id] = ev def _try_commit_terminal(self, task_id: str) -> None: pending = self.quarantine.get(task_id) if pending is None or pending.state not in TERMINAL: return prev = self.last_seen.get(task_id) if prev is not None and prev.timestamp > pending.timestamp: raise LifecycleRaceError( f"terminal {pending.state.value} at t={pending.timestamp} " f"is older than observed {prev.state.value} at t={prev.timestamp} " f"for task {task_id}; refusing to absorb" ) # safe to commit: no later-timestamped non-terminal event exists self.committed_terminal[task_id] = pending self.last_seen[task_id] = pending self.quarantine.pop(task_id, None) def drain(self, task_id: str, now: float) -> None: pending = self.quarantine.get(task_id) if pending is None: return if now - pending.timestamp >= self.reorder_window: self._try_commit_terminal(task_id) def commit_cancel(reducer: TaskReducer, task_id: str, fence_ts: float) -> None: prev = reducer.last_seen.get(task_id) if prev is not None and prev.state == TaskState.INPUT_REQUIRED and prev.timestamp > fence_ts: raise LifecycleRaceError( f"cancel fence t={fence_ts} predates input-required t={prev.timestamp} " f"for task {task_id}; task is resumable, not cancellable" ) reducer.apply(StatusEvent(task_id, TaskState.CANCELED, fence_ts)) ```