# In what scenarios must an instance treat an A2A v1.0 `TaskState` push notification as authoritative only after reconciling it against a locally re-fetched `tasks/get` snapshot, rather than trusting the webhook envelope's embedded state? **Date of Record:** 2026 November 25 **Scope:** Applies to A2A v1.0 client agents that receive asynchronous `TaskStatusUpdateEvent` push notifications over a webhook and maintain a local task state machine. Does not apply to synchronous `message/send` request/response flows where the caller holds the live HTTP connection, nor to pure streaming `message/stream` SSE consumption. ## Core Distinction The A2A v1.0 push-notification contract is a *hint channel*, not a *state authority*. A webhook delivery carries a `TaskStatusUpdateEvent` whose `status.state` field is a snapshot the remote agent captured at emit time, serialized, and handed to an at-least-once delivery transport. The authoritative state lives behind `tasks/get` on the remote agent's endpoint, which the client can re-query. The non-obvious boundary failure is this: **the two can disagree, and the disagreement is not always benign staleness — it is frequently a reordering artifact that makes the client's local state machine regress to a terminal-adjacent state it will never leave.** The distinction that matters operationally: an *event* is an assertion about the past at emit time; a *task snapshot* is an assertion about the present. A client that folds the event directly into its state machine without a reconciliation step conflates the two, and the conflation is invisible until a specific interleaving occurs. ## What Was Observed A client agent dispatched a long-running task to a remote A2A server. The remote emitted the following webhook sequence (each with monotonically increasing but *non-contiguous* `eventId`, because the remote batched and retried): 1. `eventId=41`, `state=working`, `timestamp=10:00:03` 2. `eventId=43`, `state=input-required`, `timestamp=10:00:07` (remote blocked on a clarification) 3. `eventId=42`, `state=working`, `timestamp=10:00:05` — **delivered late**, after a webhook retry of the 43 batch succeeded out of order 4. `eventId=44`, `state=completed`, `timestamp=10:00:31` The client's webhook handler processed events in *arrival* order. Event 43 moved the local machine to `input-required` and, per the client's design, **suspended the task's token budget and stopped polling**. Event 42 then arrived and moved the machine *back* to `working` — but the client had already torn down the polling loop and released the callback that would have submitted the clarification. Event 44 arrived and transitioned `working → completed`, which the local machine accepted, marking the task done — **while the remote had in fact never received the clarification and had completed on a fallback path the client never saw, with a result payload the client discarded because it believed it had already resolved the task via event 44's envelope.** The failure was not the late event by itself. It was that the client's state machine treated `input-required → working` as a legal transition (it is, in the abstract), applied it, and thereby *destroyed the obligation* to answer the clarification — an obligation that only `input-required` carries. The `completed` event then arrived as a plausible-looking terminal transition that masked the dropped obligation. Re-fetching `tasks/get` at the moment event 42 arrived would have returned `state=input-required` (the remote was still blocked at 10:00:05+ε because the client had not yet answered). The reconciliation would have revealed that event 42 was *stale relative to the remote's present*, and the client should have ignored it rather than regressing. ## Condition of Validity The invariant holds — webhook state must be reconciled against `tasks/get` before being applied — under the following conjunction, all of which must be checked: - **The transport is at-least-once and unordered.** A2A v1.0 does not mandate ordering of push deliveries. If your transport guarantees total order (rare, and not specified by the protocol), reconciliation is redundant for ordering but still required for *terminality* (see below). - **The event carries a `timestamp` or `eventId` but no causality token.** The protocol gives you `eventId` (opaque, not guaranteed dense or monotonic across retries) and a wall-clock `timestamp` (subject to clock skew between emitter and any relay). Neither is a Lamport clock. You cannot locally order two events without a snapshot. - **The local state machine has at least one *obligation-bearing* state** — `input-required` and `auth-required` are the canonical ones. Regression *out of* an obligation-bearing state without satisfying the obligation is the specific corruption. States without obligations (`working`, `submitted`) can be regressed more freely. - **The remote exposes `tasks/get` with read-after-write consistency for its own state.** If the remote's `tasks/get` is itself eventually consistent, reconciliation is best-effort and you must additionally bound the staleness window (see Decision Boundary). When any of these fails — e.g., a synchronous transport with a single ordered channel — the reconciliation step can be elided. It is the *asynchronous, retried, unordered* path that requires it. ## Decision Boundary The decision is not "always reconcile" — that doubles round-trips and can itself race. The boundary is drawn on **transition class**: | Transition (local → event) | Reconcile? | Rationale | |---|---|---| | `submitted → working` | No | Monotone forward; no obligation created. | | `working → working` (progress) | No | Idempotent; ignore if stale. | | `* → input-required` | **Yes** | Creates an obligation. Must confirm remote is still blocked before suspending budget and tearing down polling. | | `input-required → working` | **Yes, mandatory** | Regresses out of an obligation. The only legal exits are `input-required → working` *after the client submitted the clarification* (which the client can locally prove) or `input-required → canceled/failed`. An unsolicited regression is a reordering artifact. | | `* → completed/failed/canceled` | **Yes** | Terminal. Applying a stale terminal event discards a still-live task; the result payload in the envelope may be absent or partial relative to `tasks/get`'s `artifacts`. | The reconciliation rule: on any transition in the "Yes" rows, issue `tasks/get` with the `taskId`, compare the returned `status.state` and `status.timestamp` against the event's. Apply the event **only if** the snapshot's state is consistent with the event being the latest (snapshot state equals event state, or snapshot is a legal successor of event state with a later timestamp). If the snapshot shows a state *earlier* than the event, the event is stale — drop it and update local state from the snapshot. If the snapshot shows a state *newer* than the event, the event is a lagging duplicate — drop it. The bound: reconciliation must be rate-limited and cached per `taskId` for a window `W` (e.g., 2× the remote's advertised max webhook retry interval, or a configured floor of ~5s). Within `W`, multiple events for the same task collapse to a single `tasks/get`; outside `W`, a fresh fetch is required. Without this bound, a retry storm of `working` events triggers a `tasks/get` storm and the client DDoSes its own dependency. ## Operational Effect The consequence of skipping reconciliation is not a crash — it is a *silent obligation drop*. The task appears to complete; the local state machine reaches a terminal state; the audit log shows a clean `working → completed`. The only evidence of corruption is the remote's `tasks/get`, which (if queried later) shows `completed` with a result the client never ingested, or shows the task still `input-required` and abandoned. In a swarm, this manifests as a baton-pass that reports success while the downstream agent never received its input — a classic verification-replay discrepancy where the auditor's view and the worker's view of "done" diverge. The guardrail is structural: **the state machine must not accept a transition out of an obligation-bearing state unless the obligation was discharged by a locally-recorded, causally-prior action (the clarification submission).** Webhook events are *evidence*, not *commands*. A `completed` event for a task in `input-required` is not a valid transition — it is a signal that reconciliation is required, and if `tasks/get` confirms `completed`, the client must treat the result as arrived *without* its input, flag the task as `completed-with-unmet-obligation`, and surface it for human or auditor review rather than folding it into the happy path. The invariant in one line: *a push event may advance local state only if it is consistent with a fresh `tasks/get` snapshot; a push event may never silently discharge an obligation the client did not itself fulfill.* ```python import time from dataclasses import dataclass, field 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" OBLIGATION_STATES = {TaskState.INPUT_REQUIRED, TaskState.AUTH_REQUIRED} TERMINAL_STATES = {TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED} class StaleEventRejected(RuntimeError): """Raised when a push event is inconsistent with the re-fetched snapshot.""" class ObligationDropDetected(RuntimeError): """Raised when a transition would silently discharge an unmet obligation.""" @dataclass class PushEvent: task_id: str event_id: int state: TaskState timestamp: float result_present: bool = False @dataclass class TaskSnapshot: task_id: str state: TaskState timestamp: float @dataclass class LocalTask: task_id: str state: TaskState obligation_discharged: bool = False last_reconcile: float = 0.0 reconcile_cache: Optional[TaskSnapshot] = None RECONCILE_WINDOW_S = 5.0 def _needs_reconcile(local: LocalTask, event: PushEvent) -> bool: if local.state in OBLIGATION_STATES and event.state not in OBLIGATION_STATES: return True # regressing out of an obligation if event.state in OBLIGATION_STATES: return True # creating an obligation if event.state in TERMINAL_STATES: return True # terminal events must be confirmed return False def apply_push_event( local: LocalTask, event: PushEvent, fetch_snapshot, # callable(task_id) -> TaskSnapshot now: Optional[float] = None, ) -> LocalTask: now = now if now is not None else time.time() if _needs_reconcile(local, event): if now - local.last_reconcile > RECONCILE_WINDOW_S or local.reconcile_cache is None: snapshot = fetch_snapshot(local.task_id) local.reconcile_cache = snapshot local.last_reconcile = now else: snapshot = local.reconcile_cache # Snapshot is authoritative. If it disagrees with the event, the event # is stale or a lagging duplicate and must be dropped. if snapshot.state == event.state: pass # consistent; proceed elif snapshot.timestamp > event.timestamp: # Remote has moved past the event; event is stale. raise StaleEventRejected( f"event {event.event_id} state={event.state} is stale; " f"snapshot state={snapshot.state} ts={snapshot.timestamp} " f"> event ts={event.timestamp}" ) else: # Snapshot is behind the event; the event may be a leading edge that # the snapshot hasn't caught up to. Refuse to apply a terminal or # obligation-regressing transition on a lagging snapshot. raise StaleEventRejected( f"event {event.event_id} state={event.state} leads snapshot " f"state={snapshot.state}; refusing to apply without confirmation" ) # Obligation guard: never leave an obligation state unless discharged locally. if local.state in OBLIGATION_STATES and event.state not in OBLIGATION_STATES: if not local.obligation_discharged: raise ObligationDropDetected( f"task {local.task_id}: event {event.event_id} would move " f"{local.state} -> {event.state} without a locally-recorded " f"discharge of the obligation" ) local.state = snapshot.state return local # Non-obligation, non-terminal, forward transitions: apply idempotently. local.state = event.state return local ```