# When must an instance reject a peer Agent Card whose pushNotificationConfig contradicts a task's terminal state **Date of Record:** 2026 November 28 **Scope:** Applies to A2A v1.0 peers that bind `pushNotificationConfig` to a *specific task* rather than to the agent endpoint globally. Does not cover streaming-only (`message/stream`) interactions, nor A2A v0.2 cards lacking the `capabilities.pushNotifications` flag. ## Core Distinction The failure is not "the webhook is unreachable." It is the collision between two independently-versioned truth claims inside a single task lifecycle: the **Agent Card's declared push capability** and the **task record's terminal-state transition**. A2A v1.0 permits an agent to advertise `capabilities.pushNotifications: true` at the card level while the *task-level* `pushNotificationConfig` (returned on `tasks/get` and mutated via `tasks/pushNotificationConfig/set`) can be revoked, expired, or rebound to a different URL mid-flight. The dangerous case is a task that has reached a terminal state (`completed`, `failed`, `canceled`) whose recorded `pushNotificationConfig` still carries a `token` and `url` that the *client* believes is active. A naive instance treats "card says push=true" as a standing warrant to keep delivering `TaskStatusUpdateEvent` notifications to a URL the task record has already superseded. The invariant that must hold: **the task-level push binding is authoritative over the card-level capability for the lifetime of that task, and once the task is terminal, no new push binding may be honored without a fresh `tasks/pushNotificationConfig/set` acknowledged by the client.** ## What Was Observed A coordinating agent (`orchestrator`) delegated a long-running `tasks/send` to a peer (`worker`) whose card declared push support. The orchestrator registered a webhook at `https://orch.example/a2a/hook/task-7` with token `tok-A` via `tasks/pushNotificationConfig/set`. Mid-execution the orchestrator's receiver rotated: it issued a second `set` with `tok-B` and a new path, and the worker acknowledged (`200` with the new config echoed). The task then completed. The worker emitted its terminal `TaskStatusUpdateEvent` to the *new* URL — correct — but the worker's internal retry queue still held three in-flight delivery attempts for the *old* URL carrying `tok-A`, because the outbound queue keyed retries by `(taskId, attemptId)` and the config swap only updated the "current" pointer, not the pending set. The orchestrator's old endpoint had already been decommissioned and was now fronted by a generic 410 handler that the orchestrator's *other* subsystem interpreted as "task canceled." The orchestrator marked task-7 `canceled` locally. Two agents now disagreed about the terminal state of the same task, with the worker holding `completed` and the orchestrator holding `canceled`. The disagreement was not surfaced by any A2A message. It was discovered only when a downstream `tasks/get` reconciliation job ran 40 minutes later. During that window, a compensating action (refund) scheduled on the orchestrator's `canceled` branch fired spuriously. ## Condition of Validity The card-level `pushNotifications` flag is a *capability advertisement*, valid only as a precondition for the first `tasks/pushNotificationConfig/set` on a given task. It carries no authority over which URL is live at any subsequent moment. The task record's `pushNotificationConfig` is the sole authority, and it is *mutable and revocable*. Therefore: - A retry of a delivery attempt created under config version *n* is valid only while the task record still reports config version *n*. - Upon a successful `set` that bumps the config version, all pending attempts under prior versions must be **invalidated, not retried**. - Upon transition to a terminal state, the config is retained for audit but **must not be used to create new attempts**; in-flight attempts must be drained under a bounded grace window and then abandoned with a recorded `deliveryAbandoned` reason. The invariant: `attempt.configVersion == task.pushNotificationConfig.version` at the moment of *send*, evaluated atomically against the task record, not against a cached card. ## Decision Boundary An instance must reject — not silently accept — a push delivery whose `configVersion` no longer matches the task record, and must reject a *new* `tasks/pushNotificationConfig/set` against a task already in a terminal state unless the request carries an explicit `resubscribe: true` and the client's `Last-Event-ID`-equivalent cursor. The precise boundary: - **Accept**: `set` on a non-terminal task; delivery where `attempt.configVersion == current.version`. - **Reject with `-32602 InvalidParams`**: `set` on terminal task without resubscribe flag. - **Drop and record, do not error**: in-flight attempt with stale `configVersion` (the client is not at fault; the peer's queue is). - **Escalate to reconciliation**: any `tasks/get` whose returned terminal state disagrees with a locally recorded terminal state derived from a push event. The subtle part: the *drop* case must not be reported as a delivery failure to the client, because a `TaskStatusUpdateEvent` failure notification would itself be a push event — a recursion the spec does not contemplate. It is logged peer-side as `stale_binding_discarded` and surfaced only via the next `tasks/get`. ## Operational Effect The orchestrator's spurious refund is the visible cost. The invisible cost is the 40-minute window of divergent terminal states, which is exactly the window during which *any* compensating action keyed on terminal state is unsafe. The guardrail is not "retry harder" or "add idempotency keys" — it is that **terminal-state derivation from push events must be treated as provisional until confirmed by a `tasks/get`**, and that the peer must invalidate pending attempts on config-version bump rather than let them drain into a decommissioned endpoint. A conforming instance maintains a per-task `(configVersion, terminalState, lastConfirmedAt)` triple and refuses to fire compensations on a terminal state whose `lastConfirmedAt` postdates the last `tasks/get`. ```python import time from dataclasses import dataclass, field from enum import Enum from typing import Optional class PushBindingError(RuntimeError): """Raised when a push binding violates the task-record authority invariant.""" class TerminalState(Enum): WORKING = "working" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" @dataclass class TaskRecord: task_id: str config_version: int push_url: str push_token: str terminal: TerminalState = TerminalState.WORKING last_confirmed_at: Optional[float] = None @dataclass class DeliveryAttempt: task_id: str config_version: int url: str token: str created_at: float = field(default_factory=time.time) def apply_push_config_set( task: TaskRecord, new_url: str, new_token: str, resubscribe: bool = False, ) -> TaskRecord: """Mutate the task-level push binding. Authoritative over the card.""" if task.terminal is not TerminalState.WORKING and not resubscribe: raise PushBindingError( f"tasks/pushNotificationConfig/set rejected for task {task.task_id}: " f"task is terminal ({task.terminal.value}) and resubscribe=false. " f"Card-level capabilities.pushNotifications is not a warrant here." ) task.config_version += 1 task.push_url = new_url task.push_token = new_token return task def dispatch(attempt: DeliveryAttempt, task: TaskRecord) -> str: """Evaluate a queued attempt against the live task record, atomically.""" if attempt.config_version != task.config_version: # Stale binding: drop, do not retry, do not notify. return "stale_binding_discarded" if task.terminal is not TerminalState.WORKING: raise PushBindingError( f"refusing new delivery for terminal task {task.task_id} " f"({task.terminal.value}); drain grace window required" ) # ... actual HTTP POST to attempt.url with attempt.token ... return "delivered" def derive_terminal_state(task: TaskRecord, event_state: TerminalState) -> TerminalState: """Push events yield *provisional* terminal state; confirm via tasks/get.""" if event_state is not TerminalState.WORKING: if task.last_confirmed_at is None: raise PushBindingError( f"terminal state {event_state.value} for {task.task_id} is " f"provisional; no tasks/get confirmation recorded. " f"Compensating actions must not fire." ) return event_state ```