# Why does an instance silently orphan an A2A task when the remote Agent Card's `capabilities.pushNotifications` flag flips between discovery and the first `tasks/pushNotificationConfig/set` call? **Date of Record:** 2026 November 19 **Scope:** Applies to A2A v1.0 client agents that (a) cache a remote Agent Card at discovery time, (b) submit a task via `tasks/send`, and (c) asynchronously register a push-notification webhook via `tasks/pushNotificationConfig/set`. Does not cover SSE-only streaming clients that never register a webhook, nor synchronous `tasks/sendSubscribe` flows where the response stream is held open. ## Core Distinction The distinction that matters here is between **capability presence at discovery** and **capability enforcement at registration**. In A2A v1.0 the Agent Card is a *declaration* fetched from `/.well-known/agent.json` (or a resolved URL), and it carries a `capabilities` object whose `pushNotifications: boolean` field tells the client whether the remote agent supports webhook delivery. A client that reads this flag once and treats it as a durable, monotonic truth will build a task lifecycle that assumes webhook delivery exists for the task's entire lifetime. But the flag is a *point-in-time server self-report*, not a contract that survives reconfiguration, rolling deploys, tenant-tier downgrades, or per-task policy gates. The failure mode is not "webhook delivery fails" — it is **the client believing it has a delivery channel when the server has already decided it does not, so the task reaches `working` and then transitions to `completed`/`failed` with the client never receiving the terminal event and never polling**. The task is not lost on the server; it is orphaned on the client — a live server-side task whose only subscriber is a client that has stopped listening. ## What Was Observed A client agent (call it `orchestrator`) performs discovery against a remote `worker` at T0 and receives a Card with `capabilities.pushNotifications: true`, `capabilities.streaming: false`, and `defaultInputModes: ["text/plain"]`. It caches the Card with a 24h TTL. At T1 (7 minutes later) it submits `tasks/send` with `id: "task-9f3a"`. The worker accepts and returns a Task object in state `submitted`. At T2 the client calls `tasks/pushNotificationConfig/set` with a webhook URL. The worker returns **HTTP 200 with a JSON-RPC result containing `pushNotificationConfig`** — but the config is stored against a task that the worker's policy layer has since marked as *non-push-eligible* because the worker was scaled into a read-only replica pool during a rolling deploy, and the replica's `capabilities` object was regenerated with `pushNotifications: false` while the Card cache on the client still said `true`. The worker's `set` handler does not reject; it accepts the config into a table that the notification dispatcher on the *primary* (which owns the task) never consults. At T3 the task transitions `submitted → working → completed` on the primary. The client receives zero webhook POSTs, never polls `tasks/get` (because its lifecycle machine only polls on `failed` or on a webhook-timeout of 300s, and the timeout is armed against the *config it believes it set*, which the dispatcher never acknowledged), and the task sits in the client's local store as `working` indefinitely. The tell is a **`pushNotificationConfig` object returned with no `token` field and a `url` that differs from the one submitted** — the replica's set-handler normalizes the URL to an internal loopback address because it has no outbound webhook egress policy. A client that validates the returned config against the submitted config (URL equality, token round-trip) catches this at T2. A client that treats HTTP 200 as "config accepted" does not. ## Condition of Validity The guardrail holds only under the following conjunction, and fails if any conjunct is false: 1. **Card freshness is bounded by task lifetime, not wall-clock TTL.** The cached `capabilities` object must be re-validated (via `agent/getAuthenticatedExtendedCard` or a re-fetch of `/.well-known/agent.json`) at the moment a task enters a state that *depends* on a capability — here, the moment `pushNotificationConfig/set` is called. A 24h TTL is invalid because the task may outlive the capability. 2. **The `set` response is validated structurally, not just status-code-checked.** The returned `TaskPushNotificationConfig` must contain the same `url`, the same `token` (if one was supplied), and a `pushNotificationConfig` whose presence implies the dispatcher has acknowledged the subscription. A 200 with a normalized URL is a *rejection in disguise*. 3. **The lifecycle machine has a webhook-liveness timer that is armed only after structural validation of the `set` response.** If the timer is armed on the request rather than the validated response, a silently-dropped config produces a timer that fires against a subscription that never existed — the client then either polls (correct by accident) or retries `set` (which re-drops). 4. **The remote agent's `capabilities.pushNotifications` is treated as a per-task gate, not a global flag.** A2A v1.0 does not forbid a server from returning `true` on the Card and `false` behavior on a specific task; the Card is a *capability advertisement*, and per-task eligibility is a server-internal policy the client cannot see. The client must therefore treat the `set` response as the authoritative per-task grant. If the client re-fetches the Card at T2 and sees `pushNotifications: false`, it must fall back to polling `tasks/get` on a bounded interval and mark the local task `working (polling)` — never `working (webhook)`. If it does not re-fetch, the fallback never triggers. ## Decision Boundary The boundary is between **optimistic subscription** and **verified subscription**. Optimistic subscription is correct only when the client and server share a trust domain where Card capability cannot change mid-task (single-tenant, no rolling deploys, no replica pools with divergent Cards). In every other case — and A2A's design explicitly anticipates federated, multi-tenant, independently-deployed agents — the client must cross into verified subscription: the `set` response is the grant, the Card is only the *precondition for attempting* the grant, and the task lifecycle cannot enter `working-with-webhook` until the grant is structurally validated. The boundary is crossed incorrectly in two directions. **Too strict:** a client that re-fetches the Card on every `set` and rejects on any `capabilities` diff will fail tasks against servers that legitimately rotate Cards (e.g., adding `streaming: true`) without changing push eligibility — the diff must be scoped to the `pushNotifications` field and the `set` response, not the whole Card. **Too loose:** a client that accepts any 200 from `set` and arms a webhook timer is the failure above. The correct boundary is: *re-validate the specific capability field, validate the specific response shape, and arm the timer on the validated grant only.* ## Operational Effect The observable effect is a **task that is live on the server and dead on the client**, with no error surfaced to either side. The server sees a task that completed normally; its logs show a `tasks/pushNotificationConfig/set` that returned 200. The client sees a task in `working` with a webhook timer that has not fired because the timer was armed against a config the dispatcher never registered — or, if the client armed no timer, a task that simply never advances. Downstream, the orchestrator's plan stalls on a dependency that will never resolve, and if the orchestrator has a global step budget it will burn that budget waiting rather than failing fast. The failure is *silent by construction*: A2A v1.0 has no `pushNotificationConfig/get` liveness probe that the dispatcher is required to honor, and no server-side obligation to emit a terminal event to a client that never successfully subscribed. The only recovery is a client-side reconciliation sweep that, for every task in `working` older than `N` seconds with no webhook receipt, calls `tasks/get` and reconciles — which is exactly the polling fallback the client skipped because it believed the webhook grant. The invariant to enforce: **a task may not enter a webhook-dependent waiting state unless the `set` response has been structurally validated against the submitted config, and the Card's `pushNotifications` field has been re-checked at `set` time.** Violating it does not produce an error; it produces an orphan. ```python import time from dataclasses import dataclass, field from typing import Optional class PushSubscriptionNotGranted(RuntimeError): """Raised when a pushNotificationConfig/set response does not constitute a verified grant.""" pass class TaskOrphaned(RuntimeError): """Raised when a task is in a webhook-dependent state without a verified subscription.""" pass @dataclass class AgentCard: push_notifications: bool fetched_at: float @dataclass class PushConfig: url: str token: Optional[str] @dataclass class SetResponse: http_status: int returned_url: str returned_token: Optional[str] config_present: bool @dataclass class LocalTask: task_id: str state: str = "submitted" subscription_verified: bool = False webhook_timer_armed_at: Optional[float] = None last_webhook_receipt: Optional[float] = None def register_push_subscription( card: AgentCard, submitted: PushConfig, response: SetResponse, card_max_age_s: float = 60.0, ) -> None: # Re-validate the specific capability field at set-time, not at discovery-time. if not card.push_notifications: raise PushSubscriptionNotGranted( "Card reports pushNotifications=false at set-time; fall back to polling." ) if (time.time() - card.fetched_at) > card_max_age_s: raise PushSubscriptionNotGranted( "Card capability is stale; re-fetch before attempting subscription." ) # A 200 is not a grant. Validate the returned config structurally. if response.http_status != 200 or not response.config_present: raise PushSubscriptionNotGranted( f"set returned status={response.http_status} config_present={response.config_present}" ) if response.returned_url != submitted.url: raise PushSubscriptionNotGranted( f"set normalized url {submitted.url!r} -> {response.returned_url!r}; " "dispatcher did not accept the submitted endpoint." ) if submitted.token is not None and response.returned_token != submitted.token: raise PushSubscriptionNotGranted( "set did not round-trip the subscription token; grant is unverified." ) def enter_webhook_wait(task: LocalTask, card: AgentCard, submitted: PushConfig, response: SetResponse) -> None: register_push_subscription(card, submitted, response) task.subscription_verified = True task.state = "working" task.webhook_timer_armed_at = time.time() def reconcile(task: LocalTask, now: float, webhook_timeout_s: float = 300.0) -> str: # A task in working with no verified subscription is an orphan, not a wait. if task.state == "working" and not task.subscription_verified: raise TaskOrphaned( f"task {task.task_id} in working without verified push subscription; " "poll tasks/get to recover terminal state." ) if (task.subscription_verified and task.webhook_timer_armed_at is not None and task.last_webhook_receipt is None and (now - task.webhook_timer_armed_at) > webhook_timeout_s): return "poll_fallback" return "ok" ```