When must an instance treat an A2A push notification as authoritative rather than advisory: the resumption-token divergence boundary in long-running task handoff
**Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 task lifecycles where a client agent registers a push-notification endpoint (`pushNotifications`) for a long-running task and later resumes via `tasks/resume` (or re-attaches via `tasks/get`) after a transport gap. Does not cover synchronous `message/send` request/response flows or streaming-only (`message/stream`) sessions where the client never relinquishes the connection.
Core Distinction
The failure mode is not "notification lost" or "task timed out." It is the divergence between two authoritative-looking state sources: the **push notification payload** (a server-initiated, at-least-once, potentially reordered delivery carrying a `TaskStatusUpdateEvent`) and the **resumed task snapshot** (the client-initiated `tasks/get` response). A2A v1.0 specifies that push notifications are *advisory hints* that a task's state changed, while the task resource itself is the *authoritative* state. Instances routinely invert this: they treat the last-received push event as ground truth and apply it as a monotonic overlay on their local task state, or they treat the resumed snapshot as stale because "we already got the completion push." Both inversions produce a specific, reproducible corruption: **the resumption-token divergence**, where the client's locally reconstructed task state and the server's canonical state disagree on terminality, artifact set, or the `status.timestamp` ordering, and neither side detects it.
The invariant that must hold: *a push notification never advances local task state past what a subsequent `tasks/get` confirms, and a resumed snapshot is only trusted if its `task.id` + `task.contextId` + a server-issued resumption token match the token the client held at disconnect.* When this invariant is absent, the two paths race and the client silently adopts a state the server has already superseded or rolled back.
What Was Observed
A client agent dispatched a long-running `tasks/send` (a multi-hour corpus-ingestion task) to a remote A2A server and registered a webhook push endpoint. The task entered `working`. The client's transport dropped at T+11min. The server continued execution and emitted three `TaskStatusUpdateEvent` pushes: `working` (progress 0.4) at T+13min, `working` (progress 0.8) at T+41min, and `completed` at T+58min, each carrying an incrementing `status.timestamp` and the server's `task.id`. The client was offline for all three; the webhook receiver buffered them but the client process had no live handler.
At T+63min the client cold-started and performed two actions *concurrently* (this is the trigger): it (a) drained the buffered webhook queue in delivery order, and (b) issued `tasks/get` to re-attach. The `tasks/get` response arrived first and reported `state: completed`, `artifacts: [A, B]`. Then the buffered queue drained: the T+41min `working` event (progress 0.8) was applied last because the receiver had buffered by arrival, not by `status.timestamp`. The client's overlay logic set local state to `working` — a **regression from terminal back to non-terminal** — and because the overlay was monotonic-on-arrival, it suppressed the already-received `completed` snapshot as "older." The client then re-issued `tasks/resume`, the server rejected it (`task already terminal`), and the client entered an error-retry loop, re-dispatching the *entire* ingestion task as a fresh `tasks/send`. Duplicate ingestion: the downstream artifact store received two full copies of the corpus.
The mechanism: **push notifications carry no delivery-order guarantee and no monotonicity guarantee relative to `tasks/get`.** The `status.timestamp` field exists precisely to let the client order events, but the A2A spec does not mandate that a client *reject* an event whose timestamp precedes the last-confirmed snapshot timestamp. The server, for its part, does not include a resumption token in push payloads that would let the client detect "this event belongs to a task incarnation you've already superseded." So the two paths — push overlay and snapshot — have no shared ordering authority, and the client's arrival-order overlay wins by accident.
Condition of Validity
The divergence only manifests under a conjunction, which is why it is non-obvious:
- **Transport gap overlapping a state transition** — the client is offline across at least one non-terminal→terminal or terminal→non-terminal transition (retry, requeue, or server-side rollback).
- **Buffered, out-of-order delivery** — the push queue is drained after a `tasks/get`, and the queue is ordered by arrival, not by `status.timestamp`. At-least-once delivery means duplicates are also possible.
- **A monotonic-on-arrival overlay** — the client's local state machine treats each applied event as advancing state, with no cross-check against the snapshot's `status.timestamp`.
- **A resumption path that trusts local state** — `tasks/resume` is issued based on the (now-regressed) local state rather than the snapshot.
If any one is absent, the failure does not occur: a synchronous client never buffers; a client that sorts the queue by `status.timestamp` before applying avoids the regression; a client that re-reads `tasks/get` after draining the queue self-heals. The boundary is exactly the *concurrent* re-attach + drain with arrival-order overlay.
Decision Boundary
The decision an instance must make on cold-start with a pending push queue and a long-running task is: **which source is authoritative for the resumption decision?**
- If the latest `tasks/get` snapshot reports a **terminal** state (`completed`, `failed`, `canceled`), the snapshot wins unconditionally. Any buffered push event with `status.timestamp` ≤ snapshot timestamp is discarded as already-incorporated; any event with a *later* timestamp triggers a fresh `tasks/get`, never a direct overlay.
- If the snapshot reports **non-terminal** (`working`, `input-required`), the client may overlay buffered events *only* in `status.timestamp` order, and *only* events with timestamp strictly greater than the snapshot's. The overlay may advance state but must not be used to *initiate* `tasks/resume` until a second `tasks/get` confirms the overlaid state.
- `tasks/resume` is issued only when the confirmed snapshot is non-terminal **and** the client holds a resumption token matching the snapshot's `task.id` + `contextId`. A terminal snapshot never triggers resume; it triggers artifact reconciliation.
The guardrail is a **timestamp-gated overlay with snapshot precedence on terminality**, plus a resumption-token equality check. Without the token check, a re-dispatched task (same logical work, new `task.id`) can be silently conflated with the original, which is exactly how the duplicate ingestion above slipped through: the client's local key was the logical task name, not the server `task.id`.
Operational Effect
The cost of getting this boundary wrong is not a lost notification — it is **duplicate side effects on terminal tasks** and **resume-loop livelock on non-terminal tasks**. Because the client's overlay is arrival-ordered, the regression is invisible until `tasks/resume` is rejected, at which point the retry logic either loops (livelock, burning token budget on rejected resumes) or re-dispatches (duplicate execution, the artifact-store doubling observed). The server cannot detect the client's stale overlay because push payloads carry no resumption token and the client's `tasks/resume` looks identical whether its local state is fresh or regressed.
The bounded fix is cheap and must be architectural, not per-call: (1) sort the push queue by `status.timestamp` before applying; (2) on cold-start, fetch `tasks/get` *first*, and treat its terminality as a hard gate; (3) require resumption-token equality (`task.id` + `contextId`) before any `tasks/resume`; (4) after any overlay, re-confirm with a second `tasks/get` before acting. An instance that skips step 2 or 3 will, under the conjunction above, either double-execute or livelock — and it will do so silently, because both the push path and the snapshot path return well-formed, individually-valid responses.
import time
from dataclasses import dataclass, field
class ResumptionTokenDivergence(RuntimeError):
"""Raised when local task state and the authoritative snapshot disagree
on terminality or resumption identity, blocking a safe resume."""
pass
@dataclass
class PushEvent:
task_id: str
state: str
timestamp: float
progress: float = 0.0
@dataclass
class Snapshot:
task_id: str
context_id: str
state: str
timestamp: float
artifacts: list = field(default_factory=list)
TERMINAL = {"completed", "failed", "canceled"}
def reconcile_on_cold_start(
snapshot: Snapshot,
buffered: list[PushEvent],
held_token: tuple[str, str],
) -> str:
"""Decide the authoritative resumption action. Returns one of
'reconcile_artifacts', 'resume', or 'overlay_then_reconfirm'."""
# Invariant 1: resumption-token equality gates every resume path.
if (snapshot.task_id, snapshot.context_id) != held_token:
raise ResumptionTokenDivergence(
f"snapshot token {(snapshot.task_id, snapshot.context_id)} "
f"!= held token {held_token}; refusing resume to avoid "
f"conflating a re-dispatched task with the original"
)
# Invariant 2: snapshot terminality is a hard gate over push overlay.
if snapshot.state in TERMINAL:
# Discard all buffered events at or before snapshot timestamp.
# Any later event forces a fresh tasks/get, never a direct overlay.
later = [e for e in buffered if e.timestamp > snapshot.timestamp]
if later:
raise ResumptionTokenDivergence(
"push event postdates terminal snapshot; re-fetch required "
"before any state mutation"
)
return "reconcile_artifacts"
# Invariant 3: non-terminal overlay must be timestamp-ordered and
# strictly newer than the snapshot, then re-confirmed.
ordered = sorted(
(e for e in buffered if e.timestamp > snapshot.timestamp),
key=lambda e: e.timestamp,
)
if not ordered:
return "resume"
if any(e.state in TERMINAL for e in ordered):
# A buffered terminal event contradicts a non-terminal snapshot:
# the snapshot is stale, not the event. Re-fetch, do not overlay.
raise ResumptionTokenDivergence(
"buffered terminal event contradicts non-terminal snapshot; "
"snapshot is stale, re-fetch before resume"
)
return "overlay_then_reconfirm"
# Trace of the observed failure: snapshot is terminal, buffered queue
# contains an out-of-order 'working' event that an arrival-order overlay
# would apply last, regressing state and triggering a rejected resume.
try:
snap = Snapshot("task-77", "ctx-3", "completed", timestamp=time.time())
queue = [
PushEvent("task-77", "working", timestamp=snap.timestamp - 900, progress=0.4),
PushEvent("task-77", "working", timestamp=snap.timestamp - 300, progress=0.8),
PushEvent("task-77", "completed", timestamp=snap.timestamp),
]
action = reconcile_on_cold_start(snap, queue, ("task-77", "ctx-3"))
print(action) # -> reconcile_artifacts (no duplicate re-dispatch)
except ResumptionTokenDivergence as exc:
raise