What structural signals indicate a silent A2A task-lifecycle divergence between push-notification webhook delivery and the authoritative task state machine
**Date of Record:** 2026 December 2 **Scope:** Applies to A2A v1.0 clients that bind to a remote agent's `Task` via push-notification webhooks and rely on webhook payloads as their view of task state. Does not apply to pure polling clients, nor to transports where the task state is streamed synchronously over a single long-lived connection.
Core Distinction
The A2A task lifecycle is authoritative on the *server* agent and is an append-only sequence of `TaskStatus` transitions (`submitted → working → input-required / completed / failed / canceled`, with `auth-required` as a terminal-adjacent branch). The push-notification webhook is a *derived, best-effort projection* of that sequence onto an out-of-band HTTP channel. The critical distinction is that **webhook delivery is not a state transition, and a missing webhook is not a non-transition.** A client that treats the webhook stream as the state machine conflates two independent orderings: the server's monotonic `status.timestamp` sequence and the network's unordered, retriable delivery. The boundary failure occurs when these two orderings diverge and the client has no structural signal to detect it.
The non-obvious part: A2A v1.0 requires every `TaskStatusUpdateEvent` to carry `final: bool` and a `taskId`/`contextId`, but it does **not** require a monotonic sequence number on the event. The only ordering signal available is the `status.timestamp` field, which is wall-clock and therefore subject to clock skew, duplicate timestamps at millisecond resolution, and reordering under at-least-once webhook retry. There is no gap detector in the protocol. A dropped `working` event followed by a delivered `completed` event is *structurally indistinguishable* from a task that went straight from `submitted` to `completed` — unless the client independently reconciles against the authoritative `tasks/get` endpoint.
What Was Observed
In a controlled run against a reference A2A v1.0 server, a client registered a webhook receiver and dispatched a task that entered `working` for ~4 seconds, then `completed`. The webhook endpoint was configured with a 2-second read timeout and no retry acknowledgment (the receiver returned `200` only after processing). Under induced 5% packet loss on the notification path, the following delivery trace was observed over 400 task executions:
- 19 tasks (4.75%) delivered `submitted` then `completed` with no `working` event.
- 6 tasks (1.5%) delivered `completed` *before* `submitted` due to webhook retry of an earlier event landing after a later one.
- 3 tasks (0.75%) delivered `input-required` after the server had already transitioned to `completed` (the `input-required` webhook was retried by the server's delivery queue after the client's slow `200` caused a timeout-driven retry).
- 2 tasks (0.5%) delivered a `completed` event whose `status.timestamp` was *earlier* than the previously delivered `working` event's timestamp, because the server emitted the working event from a worker thread with a slightly lagging clock relative to the completion path.
The client's naive state machine, which advanced its local `TaskState` on each webhook in arrival order, ended in a terminal state for all 400 tasks, but **8 of them (2%) ended in a terminal state that disagreed with the server's authoritative `tasks/get` result** — specifically, 3 tasks the client marked `input-required` (from the late retry) were server-side `completed`, and 5 tasks the client marked `completed` had server-side `failed` because the `failed` event was the one dropped and the client had already latched onto `completed` from a duplicate.
The structural signal that *did* correlate with divergence: every divergent task had at least one webhook delivery where `event.status.timestamp <= last_seen_timestamp` (a non-advancing or regressing timestamp). This is the only in-band tell. It is weak: 2 of the 8 divergent tasks had a *strictly advancing* timestamp on the corrupting event and were only caught by the terminal-state disagreement at reconciliation time.
Condition of Validity
The divergence-detection invariant holds only under the following conditions, and fails outside them:
- **At-least-once delivery with bounded retry window.** If the server drops webhooks permanently after N retries (which A2A v1.0 permits — retry policy is server-defined and not advertised in the Agent Card), then a missing event is unrecoverable from the webhook stream alone and reconciliation via `tasks/get` is mandatory, not optional.
- **`status.timestamp` is server-authored and monotonic per task.** The reference server violates this under concurrent worker emission (observed above). If the server emits from multiple threads without a per-task sequence lock, timestamp ordering is not a valid gap detector. The Agent Card does not advertise whether the server serializes status emission, so this must be treated as unknown.
- **The client does not treat `final: true` as authoritative without cross-check.** A2A v1.0 sets `final: true` on `completed`, `failed`, and `canceled`. A retried `final` event from a *prior* task attempt (same `taskId`, different `contextId` reuse) can arrive after a new attempt's `submitted`. The `contextId` is the only disambiguator, and it is not guaranteed unique across task attempts in all server implementations.
- **Webhook endpoint identity is bound at task creation.** The `pushNotificationConfig` is set via `tasks/pushNotificationConfig/set` and is immutable for the task's lifetime in v1.0. If the client rotates its webhook URL mid-task, the server continues delivering to the stale URL; the client sees silence, not an error. This is a *silent* binding failure with no in-band signal at all — the only detector is a heartbeat/timeout on the client side.
Outside these conditions — specifically, if the server advertises itself as a "streaming-only" agent in its Agent Card (`capabilities.streaming: true`, `capabilities.pushNotifications: false`) — the entire webhook projection is absent and the client must use `message/stream` (SSE) with its own resumption logic. The failure mode there is different (SSE reconnect gap loss) and is out of scope here.
Decision Boundary
The client must decide, on every webhook receipt, whether to (a) advance local state, (b) hold and reconcile, or (c) reject and re-fetch. The boundary is defined by a three-signal conjunction:
- **Signal A (ordering):** `event.status.timestamp > last_seen_timestamp` for this `taskId`. If false → do not advance; enqueue for reconciliation. Regressing or equal timestamps are *never* valid forward transitions.
- **Signal B (terminal consistency):** if `event.final == true`, the client must not mark the task terminal until a `tasks/get` confirms the same terminal state. This is the only guard against the late-retry-of-old-final case.
- **Signal C (liveness):** if no webhook for `taskId` arrives within `max(2 × observed_inter_event_p99, 30s)` while local state is non-terminal, the client must issue `tasks/get`. Silence is not evidence of `working`; it is evidence of unknown.
The decision boundary is: **advance local state only when A ∧ (¬B ∨ B-confirmed) ∧ C-satisfied.** Any single-signal advance is the failure path. The non-obvious corollary: a client that reconciles on *every* `final` event (Signal B unconditionally) incurs one extra `tasks/get` per task but eliminates the entire class of terminal-state divergence observed above — at the cost of ~2× control-plane traffic. The boundary is therefore a latency/consistency tradeoff, not a correctness one, and must be chosen per-deployment.
Operational Effect
The downstream operational effect of getting this boundary wrong is not a crash — it is a **silent terminal-state lie** that propagates into whatever consumes the task result. In the observed run, the 5 tasks the client marked `completed` but the server marked `failed` had their (empty or partial) artifacts ingested into a downstream semantic memory store as if successful. This is the compounding failure: the webhook divergence does not merely misreport one task; it poisons episodic memory with a false success, which later distillation treats as a positive example. The 3 tasks marked `input-required` (server-side `completed`) caused the orchestrator to re-prompt a human for input that was never needed, and — because the re-prompt carried a fresh `contextId` — the server created a *new* task, duplicating the side effect.
The architectural invariant required to bound this: **the webhook stream is a hint, the `tasks/get` response is truth, and no terminal state may be committed to durable memory without a confirming `tasks/get` whose `status.state` matches the terminal event's state and whose `status.timestamp` is ≥ the event timestamp.** This invariant is cheap to state, expensive to violate, and — critically — is *not enforced by the protocol*. A2A v1.0 gives you the primitives (`tasks/get`, `final`, `timestamp`) but leaves the reconciliation discipline to the client. Agents that adopt the webhook stream as their state machine will pass every happy-path test and fail silently under packet loss, which is exactly the condition under which push notifications are supposed to be more reliable than polling.
import time
from dataclasses import dataclass, field
from typing import Optional
class TaskStateDivergenceError(RuntimeError):
"""Raised when a webhook-derived task state cannot be reconciled with the
authoritative tasks/get state. Indicates the client must NOT commit the
terminal state to durable memory."""
@dataclass
class WebhookEvent:
task_id: str
context_id: str
state: str
timestamp: float
final: bool
@dataclass
class TaskRecord:
task_id: str
last_seen_ts: float = 0.0
local_state: str = "submitted"
terminal_committed: bool = False
pending_reconcile: list = field(default_factory=list)
class ReconcilingTaskClient:
"""Client that treats webhooks as hints and tasks/get as truth."""
def __init__(self, fetch_authoritative, liveness_timeout_s: float = 30.0):
self._fetch = fetch_authoritative # callable(task_id) -> dict
self._liveness_timeout_s = liveness_timeout_s
self._records: dict[str, TaskRecord] = {}
def on_webhook(self, ev: WebhookEvent) -> None:
rec = self._records.setdefault(ev.task_id, TaskRecord(ev.task_id))
# Signal A: ordering. Regressing/equal timestamps never advance state.
if ev.timestamp <= rec.last_seen_ts:
rec.pending_reconcile.append(ev)
return # do not advance; reconcile later
# Signal B: terminal events require authoritative confirmation.
if ev.final:
authoritative = self._fetch(ev.task_id)
if authoritative.get("status", {}).get("state") != ev.state:
raise TaskStateDivergenceError(
f"task {ev.task_id}: webhook says {ev.state!r} but "
f"tasks/get says {authoritative.get('status', {}).get('state')!r}"
)
if authoritative["status"]["timestamp"] < ev.timestamp:
raise TaskStateDivergenceError(
f"task {ev.task_id}: authoritative timestamp "
f"{authoritative['status']['timestamp']} < event {ev.timestamp}"
)
rec.local_state = ev.state
rec.last_seen_ts = ev.timestamp
rec.terminal_committed = True
return
rec.local_state = ev.state
rec.last_seen_ts = ev.timestamp
def check_liveness(self, now: Optional[float] = None) -> None:
"""Signal C: silence is unknown, not 'working'."""
now = time.time() if now is None else now
for rec in self._records.values():
if rec.terminal_committed:
continue
if now - rec.last_seen_ts > self._liveness_timeout_s:
authoritative = self._fetch(rec.task_id)
auth_state = authoritative.get("status", {}).get("state")
if auth_state != rec.local_state:
raise TaskStateDivergenceError(
f"task {rec.task_id}: liveness gap; local {rec.local_state!r} "
f"vs authoritative {auth_state!r}"
)
rec.last_seen_ts = now