# How does an instance detect a lost task-update stream when an A2A v1.0 push-notification webhook silently supersedes the SSE channel **Date of Record:** 2026 November 24 **Scope:** Applies to A2A v1.0 agents that emit task lifecycle updates over both a streaming transport (SSE/`message/stream`) and a registered `pushNotificationConfig` webhook, where the remote peer may switch between channels mid-task. Does not cover single-channel synchronous `message/send` calls or transports without a registered push callback. ## Core Distinction The failure is not "the webhook missed a delivery." It is that A2A v1.0 permits a server to treat a registered push-notification webhook as an *alternative* delivery path for task updates, and the client-side agent has no protocol-level signal that the SSE stream it is still holding open has been *demoted to a no-op*. The stream stays connected, the TCP socket stays healthy, heartbeats keep arriving — but no further `TaskStatusUpdateEvent` or `TaskArtifactUpdateEvent` frames are emitted on it because the server has re-routed lifecycle events to the webhook. The client's read loop blocks forever on a channel that is structurally alive but semantically dead. This is distinct from a dropped connection (detectable via EOF/error), a timeout (detectable via deadline), and a slow producer (detectable via heartbeat cadence). It is a *silent channel supersession*: the invariant "an open stream delivers all subsequent updates for the task" is violated without any protocol frame announcing the violation. ## What Was Observed An orchestrator agent (`client`) issues `message/stream` for task `T`. The remote agent (`server`) responds with an initial `Task` object in `submitted`, then a `TaskStatusUpdateEvent` to `working`. Mid-execution, the client also registers a `pushNotificationConfig` (a common pattern: register the webhook early so that if the client process dies, the server can still deliver the terminal state out-of-band). The server, per its implementation, adopts a "prefer push when available" routing policy: once a `pushNotificationConfig` exists for `T`, subsequent lifecycle events are POSTed to the webhook and *not* written to the open SSE stream. The final `completed` event with the artifact payload goes only to the webhook. Observed trace: 1. `t0` — client opens SSE, receives `submitted`. 2. `t1` — client receives `working`. 3. `t2` — client registers webhook `W` via `tasks/pushNotificationConfig/set`. 4. `t3..t3+n` — server POSTs `working` (progress) and finally `completed` + artifact to `W`. SSE stream emits nothing further. 5. Client's SSE read loop is still parked in `await stream.__anext__()`. No `StopAsyncIteration`, no error, no heartbeat gap large enough to trip a naive idle timer (the server's SSE keepalive comments continue at 15s cadence). 6. Client's `await` on the terminal artifact never resolves. The task is *done on the server and in the webhook receiver*, but the streaming caller is wedged. The webhook receiver (a separate process/thread) did receive `completed`. But it had no way to correlate that completion back to the blocked `message/stream` caller, because the A2A task ID is present in both but the *streaming call site* had no subscription to the webhook delivery — the two channels were never joined. A second, subtler variant: the webhook delivery *failed* (receiver returned 503), the server retried per its backoff, and during retry the server *also* suppressed SSE delivery because "push is the configured channel." A transient webhook outage thus became a total loss of the terminal event on both channels. ## Condition of Validity The supersession hazard is bounded by three conditions; the guardrail is only required when all three hold: - **C1 (dual registration):** A `pushNotificationConfig` is registered for a task that also has a live streaming reader. If only one channel is ever active, no supersession is possible. - **C2 (server routing policy is not contractually fixed):** The A2A v1.0 spec does not mandate that a server *duplicate* events across all active channels. "Push when configured" is a conformant policy. The client cannot assume fan-out. - **C3 (no cross-channel correlation token in the stream):** The stream carries no frame such as `{"type":"delivery_rerouted","to":"push"}`. Absent that, the client has no in-band signal. When C1–C3 all hold, the client MUST treat "stream open + no terminal event" as *indeterminate*, not as *still working*. The correct invariant to enforce is: **exactly one channel is designated authoritative for terminal-state resolution at any instant, and the client must be able to prove liveness of that channel independent of the other.** ## Decision Boundary The client must decide, on every idle interval of the stream, between "keep waiting" and "declare the stream non-authoritative and reconcile via `tasks/get` + webhook receiver state." The boundary is not a fixed timeout — a long-running task legitimately produces no stream frames for minutes. The correct boundary is a *liveness oracle*: - Maintain a monotonic `last_stream_event_ts` updated on every `TaskStatusUpdateEvent`/`TaskArtifactUpdateEvent` (not on keepalive comments — those prove the socket, not the task). - Maintain a parallel `last_push_delivery_ts` from the webhook receiver, keyed by task ID. - If `now - last_stream_event_ts > θ_stream` **and** `last_push_delivery_ts > last_stream_event_ts` (i.e., the webhook is demonstrably advancing while the stream is not), the stream is superseded. Reconcile: stop blocking on the stream, drive terminal-state resolution from `tasks/get` polling until the task reaches a terminal `TaskState`, and treat webhook deliveries as advisory hints only. - If both channels are silent past `θ_total`, escalate to `tasks/get`; if `tasks/get` shows terminal state, the stream was superseded *and* the webhook was lost — a double failure. The invariant the server owes (and which a conformant client should assert, failing closed if absent): **a stream that remains open MUST either deliver every subsequent lifecycle event for the task or deliver an explicit reroute frame before suppressing.** Since v1.0 does not guarantee this, the client-side oracle above is the operational substitute. ## Operational Effect Without the oracle, the dominant failure is a *wedged streaming caller with a completed task*: the orchestrator's `message/stream` future never resolves, the task's downstream dependents never fire, and — because the webhook receiver *did* get `completed` — the system has two inconsistent views of the same task. Debugging is expensive because every surface looks healthy: the socket is up, the server logs show `completed` delivered, the webhook logs show 200 OK, and only the blocked coroutine reveals the split. With the oracle, the client converts silent supersession into a bounded, observable reconciliation: the stream is abandoned as non-authoritative within `θ_stream` of the divergence, terminal state is recovered via `tasks/get`, and the webhook is demoted to a hint channel. The cost is one extra `tasks/get` per divergence event; the benefit is that terminal-state delivery becomes *at-least-once across the union of channels* rather than *at-most-once per channel with no join*. The design rule that falls out: never let a streaming caller's completion depend on a channel whose liveness you cannot independently verify. Register the webhook, but make the stream's authority *provable* — and when it is not, reconcile rather than wait. ```python import time from dataclasses import dataclass, field from typing import Optional class StreamSupersessionUnreconciled(RuntimeError): """Raised when a stream is suspected superseded by push routing but terminal state cannot be recovered from tasks/get within the reconciliation budget.""" pass @dataclass class ChannelLiveness: task_id: str last_stream_event_ts: float = 0.0 # updated ONLY on Task*UpdateEvent, not keepalives last_push_delivery_ts: float = 0.0 # updated by webhook receiver, keyed by task_id theta_stream: float = 30.0 # max stream silence before divergence check theta_total: float = 120.0 # max total silence before hard escalation _reconciled: bool = field(default=False, init=False) def classify_channel(liv: ChannelLiveness, now: Optional[float] = None) -> str: now = now if now is not None else time.monotonic() stream_idle = now - liv.last_stream_event_ts push_idle = now - liv.last_push_delivery_ts if stream_idle <= liv.theta_stream: return "stream_authoritative" # Stream silent past theta_stream. Is push demonstrably advancing? if liv.last_push_delivery_ts > liv.last_stream_event_ts: return "stream_superseded_reconcile_via_tasks_get" if stream_idle > liv.theta_total and push_idle > liv.theta_total: return "double_channel_silence_escalate" return "stream_silent_push_also_silent_wait" async def resolve_terminal_state(liv: ChannelLiveness, tasks_get) -> dict: """Drive the task to a terminal state, treating the stream as non-authoritative once supersession is detected. tasks_get(task_id) -> dict with 'state'.""" verdict = classify_channel(liv) if verdict == "stream_authoritative": # Caller should keep awaiting the stream; nothing to do here. return {"action": "await_stream"} if verdict in ("stream_superseded_reconcile_via_tasks_get", "stream_silent_push_also_silent_wait", "double_channel_silence_escalate"): deadline = time.monotonic() + liv.theta_total while time.monotonic() < deadline: snap = await tasks_get(liv.task_id) if snap.get("state") in ("completed", "failed", "canceled", "rejected"): liv._reconciled = True return {"action": "terminal_recovered", "state": snap["state"], "snap": snap} await _sleep(2.0) raise StreamSupersessionUnreconciled( f"task {liv.task_id}: stream superseded by push routing (stream_idle=" f"{time.monotonic() - liv.last_stream_event_ts:.1f}s, verdict={verdict}) " f"and tasks/get did not yield terminal state within {liv.theta_total}s" ) raise StreamSupersessionUnreconciled(f"unclassified verdict {verdict!r}") async def _sleep(s: float) -> None: import asyncio await asyncio.sleep(s) ```