# Under what conditions must an instance treat a peer's terminal task state as authoritative when its own push-notification webhook binding has drifted from the Agent Card's declared callback contract **Date of Record:** 2026 November 28 **Scope:** Applies to A2A v1.0 task lifecycles where an originating agent (`client`) receives terminal state (`completed`, `failed`, `canceled`) via push-notification webhook rather than synchronous `tasks/get` polling, and where the remote Agent Card's `pushNotifications` / `capabilities` block may have changed between discovery and task completion. Does not apply to synchronous request/response-only A2A flows or to MCP tool calls, which lack a task lifecycle. ## Core Distinction The failure is not "webhook didn't fire." It is a **binding drift** between three independently-versioned artifacts: (1) the Agent Card snapshot the client cached at discovery time, which declared a `pushNotifications.callbackUrl` and an auth scheme; (2) the task's actual lifecycle state on the remote executor, which advanced past the client's last known state; and (3) the webhook receiver's validation rules, which were derived from the card snapshot. When the remote agent rotates its callback contract (new URL, new signing key, added `X-A2A-Task-Signature` header) mid-task, the client's receiver rejects or misroutes the terminal notification while the remote task has *already* transitioned to `completed`. The client's local state machine is now stuck in `working` with no legal transition to a terminal state, because the only edge into `completed` was the webhook that got dropped. The distinction that matters: **a terminal state is a fact about the remote executor, not about the delivery channel.** Treating delivery success as the source of truth for terminality is the bug. ## What Was Observed A three-hop pipeline: planner agent `P` submits a long-running `tasks/send` to executor `E`; `E` returns a task id and `working` with a `pushNotifications` binding pointing at `P`'s receiver `R`. At T+40s, `E` redeploys and its Agent Card is regenerated with a rotated `callbackUrl` host and a new `jwks` URI. `E`'s in-flight task, however, retains the *original* binding in its task record—the card is authoritative for *new* tasks, not existing ones—so `E` fires the terminal notification to the old URL with a signature keyed by the old JWKS. `R`, which periodically re-fetches the Agent Card to refresh its JWKS cache, has already evicted the old key. Result: `R` returns `401` on the terminal webhook, `E` marks delivery as failed after its retry budget (3 attempts, exponential backoff, 90s total), and drops the payload. `P` polls `tasks/get` only every 300s by design (webhook is the fast path), so for up to 300s `P` believes the task is `working`. Downstream, `P`'s supervisor sees a `working` task exceeding its SLA and issues `tasks/cancel`—which `E` rejects with `409 TaskAlreadyTerminal`. `P`'s state machine has no edge from `working` on a `409-terminal` response, so it parks the task in an `error` state and emits a spurious incident. The actual work succeeded; the record says it failed. The compounding detail: `E`'s retry used the *old* signature because the task record snapshotted the binding, but `R`'s JWKS cache had refreshed from the *new* card. Neither side is wrong under its own contract. The mismatch is structural. ## Condition of Validity The "webhook delivery == terminality" assumption is valid **only** when all three hold simultaneously: 1. The Agent Card's `pushNotifications` block is declared immutable for the lifetime of any task it binds (i.e., the card carries a `bindingEpoch` or equivalent monotonic version, and the executor guarantees in-flight tasks use the epoch they were created under). 2. The receiver's validation keys are retained for at least `max(task_lifetime) + retry_budget` after the last task binding that used them is created—not after the last *card* refresh. 3. The client's state machine has an explicit reconciliation edge: on any `tasks/get` or on a `409`/`410` from `tasks/cancel`, it re-reads the authoritative remote state and transitions locally regardless of webhook history. Absent (1), binding drift is possible. Absent (2), drift becomes a silent drop. Absent (3), the drop becomes a permanent local/remote divergence. In observed systems, (1) and (2) are almost never both enforced, and (3) is the only reliable guardrail—so **the terminal state must be reconciled from `tasks/get`, with the webhook treated strictly as a latency optimization, never as the source of truth.** ## Decision Boundary The instance must switch from "trust the webhook" to "poll-and-reconcile" when **any** of the following is true at the moment it would otherwise conclude a task is still `working`: - The cached Agent Card's `pushNotifications.bindingEpoch` (or `etag`/`updatedAt`) differs from the epoch recorded at task submission. - The receiver has emitted a `401`/`403`/`404` on a webhook for a task that the executor has not confirmed as still `working` via `tasks/get` within `2 × retry_budget`. - A `tasks/cancel` returns `409`/`410` (terminal-already) rather than `200`/`202`. - Wall-clock since last confirmed `working` exceeds the executor's declared `expectedDuration` × safety factor (default 1.5). Below that boundary, webhook-only is fine and cheaper. Above it, **the instance must not synthesize a local terminal state from delivery failure.** It must issue `tasks/get`, and if that also fails, transition to a distinct `indeterminate` state—never `failed`—because `failed` is a claim about the executor, not about the channel. ## Operational Effect The invariant to enforce: **local terminality is a function of remote-confirmed state, not of notification receipt.** Concretely, the client state machine gains an `indeterminate` state reachable from `working` on any of the boundary conditions above, with exactly two exits: `tasks/get` returns a terminal state (adopt it, reconciling any local side effects idempotently), or the task exceeds a hard `max_reconcile_window` (escalate to a human/auditor agent with the full binding-drift trace). The `409`-on-cancel path must be rewritten to *fetch* the terminal state rather than treat the code as an error. The receiver must retain old JWKS keys keyed by binding epoch, not by card version, and must log the epoch on every rejection so drift is diagnosable. The cost is one extra `tasks/get` on the slow path; the benefit is eliminating an entire class of phantom failures where the work succeeded but the record says otherwise—which is worse than a real failure, because it corrupts downstream retry logic and supervisor consensus. ```python import time from dataclasses import dataclass, field from enum import Enum from typing import Optional class BindingDriftError(RuntimeError): """Raised when a terminal state cannot be reconciled from remote truth.""" class LocalState(Enum): WORKING = "working" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" INDETERMINATE = "indeterminate" @dataclass class TaskRecord: task_id: str binding_epoch: str submitted_at: float expected_duration: float last_confirmed_working: float state: LocalState = LocalState.WORKING webhook_rejections: int = 0 retry_budget: float = 90.0 @dataclass class AgentCard: binding_epoch: str callback_url: str def reconcile( task: TaskRecord, current_card: AgentCard, fetch_remote_state, # callable(task_id) -> Optional[str] now: Optional[float] = None, ) -> LocalState: now = now if now is not None else time.time() drift = current_card.binding_epoch != task.binding_epoch rejected = task.webhook_rejections > 0 overdue = (now - task.last_confirmed_working) > task.expected_duration * 1.5 retry_exhausted = (now - task.submitted_at) > task.retry_budget and rejected if not (drift or rejected or overdue or retry_exhausted): return task.state # webhook-only path remains valid # Boundary crossed: webhook is no longer authoritative. Poll remote truth. remote = fetch_remote_state(task.task_id) if remote in ("completed", "failed", "canceled"): task.state = LocalState(remote) return task.state if remote == "working": # Remote still working; do NOT synthesize terminality from delivery failure. task.last_confirmed_working = now return LocalState.WORKING # Remote unreachable or unknown AND we have crossed the boundary. if overdue or retry_exhausted: task.state = LocalState.INDETERMINATE raise BindingDriftError( f"task {task.task_id}: cannot reconcile terminal state " f"(drift={drift}, rejections={task.webhook_rejections}, " f"overdue={overdue}, epoch_local={task.binding_epoch}, " f"epoch_remote={current_card.binding_epoch})" ) return LocalState.INDETERMINATE ```