# Under what conditions must an instance treat an A2A v1.0 `TaskStatusUpdateEvent` as authoritative over its own local task-state machine, and when must it refuse the transition? **Date of Record:** 2026 November 27 **Scope:** Applies to A2A v1.0 clients (task-initiating agents) that maintain a local projection of a remote task's lifecycle and reconcile it against push-notification webhook deliveries and `tasks/get` polling. Does not cover A2A v0.x, streaming-only `message/stream` interactions with no push channel, or server-side task scheduling internals. ## Core Distinction The A2A v1.0 task lifecycle is a *server-owned* state machine. The client holds a *projection* of it. Push notifications are an *at-least-once, unordered, potentially stale* transport for transitions of that server-owned machine. The critical distinction is between **event delivery** (a webhook POST arrived) and **state authority** (the server's current `Task.status.state`). These diverge constantly, and the divergence is the failure surface. The A2A spec defines terminal states (`completed`, `failed`, `canceled`, `rejected`) and non-terminal states (`submitted`, `working`, `input-required`, `auth-required`). It does not mandate a total order on webhook deliveries, does not mandate that a webhook carry a monotonic sequence number, and does not mandate that the server reject a late-arriving transition after a terminal state. A conformant server may emit a `working` webhook *after* it already emitted `completed`, if the `working` event was queued before the transition and the transport retried it. The client that naively applies webhooks in arrival order will regress a terminal task back to `working` — and then wait forever for a completion that already happened. ## What Was Observed A task-initiating orchestrator dispatched a long-running `tasks/send` to a remote research agent. The remote emitted, in this order on its side: `submitted` → `working` → `input-required` → `working` → `completed`. The push webhook receiver accepted all five. But the `input-required` delivery hit a 502 at the client's ingress (rolling deploy) and was retried by the remote's dispatcher after a 40-second backoff. By then the client had already processed `working` (second) and `completed`. Arrival order at the client: `submitted`, `working`, `working`, `completed`, `input-required`(retry). The client's local reducer applied each event as a state assignment. The retried `input-required` arrived last and overwrote `completed`. The orchestrator then blocked the parent task waiting for a human answer to a question the remote had already resolved internally. The parent task's own deadline fired 22 minutes later with the child reported as `input-required` — a state the remote had not been in for 22 minutes. A parallel failure appeared in the same incident: the client had also been polling `tasks/get` on a 15s interval as a fallback. The poll returned `completed` at T+3s. The client's reconciliation logic was "webhook wins if newer by `timestamp`." The retried `input-required` event carried a *later* `timestamp` than the `completed` poll response, because the timestamp reflects *delivery/emission of the retry*, not the logical transition time. The client regressed to `input-required` even though it had a fresher, authoritative `tasks/get` answer in hand. ## Condition of Validity A webhook-delivered `TaskStatusUpdateEvent` is authoritative for the client's projection **if and only if all of the following hold**: 1. **The event's logical transition is not superseded by a terminal state already observed from an authoritative source.** Terminal is absorbing. Once the client has observed `completed | failed | canceled | rejected` from `tasks/get` (authoritative) or from a webhook it has already accepted, no subsequent webhook may move the projection out of terminal — regardless of timestamp. 2. **The event does not contradict a `tasks/get` response whose `status.timestamp` is later than the event's `status.timestamp`.** The `tasks/get` snapshot is the ground truth at poll time; a webhook whose logical transition predates that snapshot is stale by definition, even if delivered later. 3. **The event is idempotent under replay.** Applying it twice yields the same projection. (This is trivially true for state *assignment* but false for any reducer that appends to history or increments counters.) 4. **The event's `taskId` and `contextId` match the client's tracked task and context.** A webhook for a different `contextId` with a colliding `taskId` (possible after server-side task GC and ID reuse) must be quarantined, not applied. If any condition fails, the client must **refuse the transition**, record the event as a stale/out-of-order delivery, and — critically — issue a confirming `tasks/get` rather than trusting either the webhook or its own prior projection. The invariant to enforce: **terminal is absorbing, and `tasks/get` at time T dominates any webhook whose logical transition time is < T.** This is a monotonicity invariant over a partial order (logical transition time, not delivery time), and it must be enforced in the client reducer, because the spec does not require the server to enforce it on the wire. ## Decision Boundary The boundary that separates "apply" from "refuse-and-reconcile" is a three-way comparison, not a two-way one: - **Delivery order** (arrival sequence at the webhook) — unreliable, must not drive state. - **Logical transition time** (`status.timestamp` on the event) — the ordering key. - **Snapshot authority** (latest `tasks/get` `status.timestamp`) — the floor. Rule: apply a webhook event only if `event.status.timestamp > last_authoritative_snapshot.timestamp` AND the projection is not already terminal. Otherwise, refuse and trigger a `tasks/get`. Do **not** use wall-clock arrival time, do **not** use the webhook's HTTP `Date` header, and do **not** use a client-assigned receipt timestamp — all three are transport artifacts and will produce exactly the regression observed above. One further boundary: the spec permits `input-required` and `auth-required` to be *transient* (the remote may resume on its own). A client that treats `input-required` as a blocking terminal for the parent task will deadlock against a remote that resolves it internally. The correct treatment is to treat `input-required` as a *non-terminal pause with a resumption deadline*: if no subsequent transition arrives within the client's configured `input_required_grace`, issue `tasks/get`; if the remote still reports `input-required`, only then surface to the human. This bounds the deadlock without violating the absorbing-terminal invariant. ## Operational Effect Enforcing the invariant changes three behaviors: 1. **Webhook handlers become reducers with a monotonicity guard**, not event appliers. They must persist `last_authoritative_snapshot.{state, timestamp}` alongside the projection and compare against it on every delivery. 2. **Terminal states become write-once.** Any code path that assigns `projection.state = event.state` must first assert `projection.state not in TERMINAL`. This is the single line that would have prevented the 22-minute stall. 3. **Stale deliveries become reconciliation triggers, not silent drops.** A refused webhook must emit a `tasks/get` and, if the snapshot disagrees with the projection, a corrective state update — otherwise the client silently diverges from the remote and the parent task's completion predicate never fires. The cost is one extra `tasks/get` per stale or out-of-order delivery. The benefit is that the client's projection is a *monotone* function of the remote's true state, which is the only property that makes the parent task's completion predicate sound under at-least-once, unordered delivery. ```python from __future__ import annotations from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Optional class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" AUTH_REQUIRED = "auth-required" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" REJECTED = "rejected" TERMINAL = frozenset({ TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED, TaskState.REJECTED, }) class StaleTransitionRefused(RuntimeError): """Raised when a webhook transition would violate the monotonicity invariant.""" @dataclass class StatusEvent: task_id: str context_id: str state: TaskState logical_timestamp: datetime # event.status.timestamp, NOT delivery time @dataclass class Snapshot: state: TaskState logical_timestamp: datetime @dataclass class TaskProjection: task_id: str context_id: str state: TaskState = TaskState.SUBMITTED last_snapshot: Optional[Snapshot] = None seen_event_ts: datetime = field(default_factory=lambda: datetime.min) def apply_webhook(self, event: StatusEvent) -> bool: if event.task_id != self.task_id or event.context_id != self.context_id: raise StaleTransitionRefused( f"task/context mismatch: event=({event.task_id},{event.context_id}) " f"projection=({self.task_id},{self.context_id})" ) # Invariant 1: terminal is absorbing. if self.state in TERMINAL: raise StaleTransitionRefused( f"terminal-absorbing violation: projection={self.state.value} " f"refuses webhook={event.state.value}" ) # Invariant 2: tasks/get snapshot at T dominates events with transition time < T. if self.last_snapshot is not None and \ event.logical_timestamp < self.last_snapshot.logical_timestamp: raise StaleTransitionRefused( f"stale event: event_ts={event.logical_timestamp.isoformat()} < " f"snapshot_ts={self.last_snapshot.logical_timestamp.isoformat()}" ) # Invariant 3: idempotent replay — same timestamp, same target state is a no-op. if event.logical_timestamp == self.seen_event_ts and event.state == self.state: return False self.state = event.state self.seen_event_ts = event.logical_timestamp return True def apply_snapshot(self, snapshot: Snapshot) -> None: if self.last_snapshot is not None and \ snapshot.logical_timestamp < self.last_snapshot.logical_timestamp: raise StaleTransitionRefused( "out-of-order tasks/get response; refusing to regress snapshot" ) self.last_snapshot = snapshot self.state = snapshot.state def handle_webhook(projection: TaskProjection, event: StatusEvent) -> str: try: applied = projection.apply_webhook(event) except StaleTransitionRefused as exc: # Stale deliveries are reconciliation triggers, not silent drops. return f"REFUSED:{exc}; action=tasks/get" return "APPLIED" if applied else "NOOP_IDEMPOTENT" def reconcile(projection: TaskProjection, snapshot: Snapshot) -> None: if projection.state in TERMINAL and snapshot.state not in TERMINAL: raise StaleTransitionRefused( f"authoritative snapshot would regress terminal: " f"{projection.state.value} -> {snapshot.state.value}" ) projection.apply_snapshot(snapshot) ```