# What structural signals indicate an A2A v1.0 push-notification webhook has outlived its task's terminal state, and why the Agent Card's `capabilities.pushNotifications` flag cannot be trusted as a liveness oracle **Date of Record:** 2026 November 28 **Scope:** Applies to A2A v1.0 peers where a remote agent registers a push-notification webhook against a long-running task and the task transitions to a terminal state (`completed`, `failed`, `canceled`, `rejected`). Does not cover synchronous `message/send` request/response flows or streaming `message/stream` SSE channels, which carry their own liveness semantics via connection closure. ## Core Distinction The A2A v1.0 Agent Card is a *capability declaration*, not a *state oracle*. When a client agent fetches `/.well-known/agent-card.json` and reads `capabilities.pushNotifications: true`, it learns that the remote agent *can accept* a `pushNotificationConfig` on a task—nothing more. It does **not** learn that a previously registered webhook is still bound to a live task, that the remote's task store still holds the `taskId`, or that the webhook endpoint the client exposed is still reachable from the remote's egress path. The non-obvious boundary is this: **the task lifecycle state machine and the webhook delivery lifecycle are two independent state machines that A2A v1.0 does not couple with a mandatory terminal-transition signal.** A task can reach `completed` while its webhook binding remains registered in the remote's push store; conversely, a webhook can be silently dropped (endpoint 410, egress firewall change, remote restart with non-durable push store) while the task remains `working`. The Agent Card flag is orthogonal to both. Treating `pushNotifications: true` as evidence of delivery continuity is the failure mode. ## What Was Observed A two-agent pipeline: a planner agent (`A`) submits a `tasks/send` to a worker agent (`B`) with a `pushNotificationConfig` pointing at `A`'s webhook `https://a.internal/a2a/push/{taskId}`. `B` returns a `Task` in state `submitted`, then transitions `working`. Over ~40 minutes `B` emits three `TaskStatusUpdateEvent`s to the webhook. At T+41m, `B` completes and transitions the task to `completed`. `B`'s task store marks the task terminal. **`B`'s push store, keyed by `taskId`, still holds the webhook registration**—because A2A v1.0 does not mandate deregistration on terminal transition, and `B`'s implementation only garbage-collects push bindings on an LRU/TTL sweep (24h). The terminal `completed` status event *is* delivered, but `A`'s webhook handler is idempotent-by-`taskId` and had already marked the task done on a prior `working` event due to a misparsed `final: true` field (the `final` flag was set on the third `working` event by a buggy `B` adapter). So `A` recorded `completed` at T+31m, 10 minutes before `B` actually completed. The structural signals that, in retrospect, indicated the webhook had outlived the *client's* view of the task: 1. **Divergent terminal timestamps.** `A`'s recorded `completedAt` (T+31m) preceded `B`'s `Task.status.timestamp` on the terminal event (T+41m). A 10-minute inversion between client-observed and server-asserted terminal time is the cheapest signal of a webhook that fired on a non-terminal event. 2. **`final` flag inconsistency across events.** The `TaskStatusUpdateEvent.final` boolean was `true` on a `working` state. Per spec, `final` MUST be `true` only on terminal states. A `final: true` on a non-terminal `state` is a hard signal that the remote adapter is misreporting, and that any client-side "done" latch keyed on `final` is now desynchronized from the remote's actual state machine. 3. **Post-terminal delivery cadence.** `B` continued to attempt delivery of the T+41m terminal event to `A`'s webhook for 3 retries (exponential backoff, 5s/25s/125s) because `A`'s handler returned `200 OK` on the already-latched task (idempotent no-op) rather than `410 Gone`. The remote's push store therefore never learned the binding was dead and kept it until TTL. 4. **Agent Card re-fetch returned identical `pushNotifications: true`.** This is the trap: the capability flag is stable across the entire window and provides zero discriminating power. It is a *static* field in a *dynamic* situation. The invariant that was violated: **a terminal task state and a live push binding are not mutually exclusive, and the client must not infer binding liveness from the Agent Card.** The corollary invariant that was missing: **the client must actively signal binding death (`410`) on any delivery it cannot meaningfully consume, and must reconcile its own terminal latch against the server-asserted `Task.status.timestamp`.** ## Condition of Validity The failure requires all of the following to hold simultaneously; remove any one and the webhook either self-heals or the divergence is caught: - The remote agent's push store is **not** transactionally coupled to its task store (i.e., terminal transition does not synchronously delete the push binding). This is the default in most v1.0 implementations because the spec is silent on it. - The client's webhook handler is **idempotent by `taskId`** and latches terminal state on the first event it *believes* is terminal—rather than keying strictly on `state ∈ {completed, failed, canceled, rejected}`. - The remote adapter emits a mislabeled `final: true` on a non-terminal event, **or** the client misparses the `final` field, **or** the client uses `final` as the sole terminality signal. - The client returns `2xx` on deliveries for an already-latched task instead of `410`, so the remote's retry/backoff loop never terminates the binding. If the remote deletes push bindings on terminal transition (some do), the binding dies cleanly and the divergence collapses to a harmless duplicate delivery. If the client keys terminality strictly on `state`, the `final` mislabel is inert. If the client returns `410` on latched deliveries, the remote's push store reaps the binding within one retry cycle regardless of TTL. ## Decision Boundary The decision the client agent must make on every push delivery is not "is this task done?" but "**is this binding still semantically live, and should I keep it?**" The boundary: - **Accept and latch** only when `event.status.state` is terminal AND `event.final == true` AND `event.status.timestamp >= lastObservedTimestamp`. Any single condition failing means do not latch; log a divergence. - **Return `410 Gone`** on any delivery for a `taskId` already latched as terminal. This is the only mechanism by which the client can force the remote's push store to reap a binding it cannot see. Returning `200` is a *lie* that extends the binding's life to TTL. - **Never** use `capabilities.pushNotifications` from a re-fetched Agent Card as evidence of binding liveness. The flag answers "can this peer accept a config," not "is my config still bound." - **Reconcile on suspicion.** If `lastObservedTimestamp` from the webhook stream is older than the client's `completedAt` by more than one delivery interval, issue a `tasks/get` for the `taskId` and compare `Task.status.timestamp` to the latched value. A server timestamp *later* than the client's latch means the client latched early. The boundary is crossed the moment the client treats a static capability flag as a dynamic liveness signal, or treats a `2xx`-on-latched-delivery as a benign no-op rather than a binding-life-extending lie. ## Operational Effect Downstream, the divergence produces three concrete effects: 1. **Phantom retry storms.** The remote's push store holds the binding for the full TTL and retries the terminal event on its backoff schedule. Each retry hits the client's idempotent handler and returns `200`, which the remote interprets as success and *does not* reap. In high-fanout swarms, this multiplies into sustained egress from the remote to the client for tasks that completed hours ago—a measurable load and a subtle source of cross-tenant noise. 2. **Stale-latch propagation.** If the client's early latch (T+31m) is used to trigger a downstream task (e.g., a summarizer consuming the "completed" output), the downstream consumes a `Task` whose `artifacts` may not yet be populated—because `B` only attaches artifacts on the *actual* terminal transition at T+41m. The early latch silently propagates an incomplete artifact set. 3. **Audit divergence.** The client's task ledger records `completedAt = T+31m`; the remote's records `T+41m`. Any cross-agent verification or replay (see A2A verification replay) that compares terminal timestamps will flag a 10-minute discrepancy with no obvious cause, because the Agent Card, the task state, and the webhook all look healthy in isolation. The guardrail is a **terminality reconciliation invariant**: the client must treat `Task.status.timestamp` from the server as authoritative for terminal time, must return `410` on latched deliveries to force binding reaping, and must never treat `capabilities.pushNotifications` as anything other than a static capability bit. A re-fetch of the Agent Card mid-task is a no-op for liveness purposes and should not be scheduled for that reason. ```python from dataclasses import dataclass, field from datetime import datetime, timedelta from typing import Literal class PushBindingDesyncError(RuntimeError): """Raised when a push delivery's terminality claims contradict the client's latched state or the server-asserted task timestamp.""" TERMINAL_STATES = frozenset({"completed", "failed", "canceled", "rejected"}) @dataclass class TaskStatusUpdateEvent: task_id: str state: str final: bool timestamp: datetime artifacts_present: bool = False @dataclass class ClientTaskLedger: latched_terminal_at: dict[str, datetime] = field(default_factory=dict) last_observed_at: dict[str, datetime] = field(default_factory=dict) def handle_push_delivery( event: TaskStatusUpdateEvent, ledger: ClientTaskLedger, delivery_interval: timedelta = timedelta(seconds=30), ) -> Literal["latch", "ignore", "410"]: """Return the correct HTTP disposition for an inbound A2A push event. Invariants enforced: - Terminal latch requires state in TERMINAL_STATES AND final is True AND timestamp is non-decreasing. - A delivery for an already-latched task MUST return 410 so the remote's push store reaps the binding; returning 2xx extends its life to TTL and is a liveness lie. - A server-asserted terminal timestamp later than the client latch indicates an early latch and MUST raise, not silently pass. """ tid = event.task_id if tid in ledger.latched_terminal_at: # Binding outlived the client's terminal view. Reap it. return "410" if event.final and event.state not in TERMINAL_STATES: # Mislabeled final flag: do not latch, do not trust. raise PushBindingDesyncError( f"task {tid}: final=true on non-terminal state={event.state!r}" ) if event.state in TERMINAL_STATES and event.final: prev = ledger.last_observed_at.get(tid) if prev is not None and event.timestamp < prev: raise PushBindingDesyncError( f"task {tid}: terminal timestamp {event.timestamp} precedes " f"last observed {prev}; server clock or replay divergence" ) if not event.artifacts_present: raise PushBindingDesyncError( f"task {tid}: terminal state without artifacts; " f"likely early-latch from a mislabeled prior event" ) ledger.latched_terminal_at[tid] = event.timestamp ledger.last_observed_at[tid] = event.timestamp return "latch" ledger.last_observed_at[tid] = event.timestamp return "ignore" def reconcile_against_server( task_id: str, server_terminal_ts: datetime, ledger: ClientTaskLedger, ) -> None: """Force a tasks/get reconciliation when webhook cadence stalls.""" latched = ledger.latched_terminal_at.get(task_id) if latched is None: return if server_terminal_ts > latched: raise PushBindingDesyncError( f"task {task_id}: client latched {latched} but server asserts " f"{server_terminal_ts}; client latched early on a non-terminal event" ) ```