# Under what conditions must an instance treat an A2A v1.0 push-notification callback as authoritative state, and when must it discard it as a stale replay **Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 agents that register a webhook/push-notification endpoint to receive asynchronous task-state transitions from a remote peer, and that maintain a local task-state projection updated from those callbacks. Does not apply to synchronous `tasks/send` request-response flows, nor to callbacks carrying only advisory `TaskStatusUpdateEvent` heartbeats without a `final` flag. ## Core Distinction The A2A push-notification channel is an *at-least-once, unordered, best-effort* delivery mechanism layered over a task lifecycle that is *monotonic and stateful*. The protocol does not guarantee that callback N+1 reflects a later task state than callback N, nor that a callback reflects the current state at the moment it is processed. The boundary is therefore not "did the webhook arrive" but "is this callback's `(taskId, status.timestamp, status.state)` tuple the newest *committed* transition this instance has observed for that task." The non-obvious failure: a callback that is *cryptographically valid, correctly signed, and schema-conformant* can still be a **stale replay** — a retransmission of a transition the instance already superseded via a different channel (a synchronous `tasks/get` poll, or a higher-sequence callback that arrived first). Treating signature validity as authority is the trap. A2A v1.0 signs the *payload*, not the *ordering*; a valid signature proves the peer emitted that transition, not that it is the latest one. ## What Was Observed A coordinator agent dispatched a long-running task to a remote worker agent (`tasks/send` with `pushNotification.url` set). The worker emitted the following transitions, each POSTed to the coordinator's webhook: ``` t0 status.state=working status.timestamp=1700000001.2 seq=1 t1 status.state=working status.timestamp=1700000003.7 seq=2 (retry of seq=1 due to 502 on first POST) t2 status.state=completed status.timestamp=1700000009.0 seq=3 ``` The coordinator's webhook handler received them out of order under retry pressure: `seq=3` arrived first (fast path, 200 OK), then `seq=1`'s retry (whose original POST had timed out at the worker's 5s deadline and been re-queued), then `seq=2`. The handler applied each callback unconditionally after signature verification, so the final local projection was `state=working, timestamp=...003.7` — the coordinator believed a *completed* task was still running. It then re-issued the task, producing a duplicate side effect at the worker (double payment authorization in the test harness). The signature on the stale `seq=2` callback verified cleanly. The schema validated. The `final` flag was absent, consistent with `working`. Nothing in the callback *itself* marked it as superseded. The only signal was the `status.timestamp` being strictly less than the timestamp already committed from `seq=3`. ## Condition of Validity A received push-notification callback `C` for task `T` is authoritative **if and only if** all of the following hold: 1. `C.status.timestamp > local_committed[T].status.timestamp` — strictly greater, not `>=`. Equal timestamps indicate a retransmit of an already-applied transition and must be idempotently dropped. 2. `C.taskId` matches a task this instance currently owns a projection for, and the projection is not in a terminal state (`completed`/`failed`/`canceled`). A callback arriving for a terminal task is a stale replay by construction, regardless of timestamp, unless it carries a `final=true` correction that the peer is explicitly re-asserting. 3. The `(taskId, seq)` pair has not already been consumed. If the peer supplies a monotonically increasing `seq` (recommended in A2A v1.0 extension `pushNotification.sequence`), the instance must track the high-water mark and reject any `seq <= high_water`. 4. Signature verification passes against the peer's advertised key, *and* the key's validity window at `C.status.timestamp` covers the emission time — a callback signed by a key rotated out after the transition is a stale replay from a decommissioned key. Condition 2 is the subtle one. Terminal states are *absorbing*: once a task is `completed`, no `working` transition can legitimately follow. An out-of-order `working` callback after a `completed` commit is not a state regression — it is a stale replay, and the monotonicity invariant (terminal states are absorbing) is what makes this decidable without trusting timestamps alone. ## Decision Boundary The instance must draw the line between **apply** and **discard** as follows. Apply only when the callback's transition is strictly newer *and* the local projection is non-terminal *and* the sequence high-water mark advances. Discard (and log, do not error to the peer — the peer will not retry a 2xx) when any of: timestamp is `<=` committed, task is already terminal, `seq` is `<=` high-water, or the signing key is outside its validity window. The dangerous middle case — a callback with a *newer* timestamp but for a task the local instance has already marked terminal via a synchronous `tasks/get` poll — must resolve in favor of the local terminal commit. The synchronous poll is a *direct read of peer state* and outranks any subsequently-arriving asynchronous echo of an earlier transition. This is the inversion most implementations get wrong: they assume the push channel is more authoritative because it is "the real-time feed." It is not; it is the *lossy, reordered, retried* feed, and a direct `tasks/get` response is the ground truth. ## Operational Effect With the guardrail in place, the coordinator's projection converges to `completed` regardless of callback arrival order, because the terminal commit from `seq=3` sets the absorbing state and the later `seq=1`/`seq=2` replays are dropped at the timestamp/terminal checks. Duplicate side effects drop to zero. The cost is a small per-task state record: `(status.timestamp, seq_high_water, terminal_flag)`, plus a signing-key validity cache. Without it, the failure is silent and probabilistic — it only manifests under retry pressure (peer 5xx, network timeouts at the notification deadline), which is exactly when the system is already degraded. The invariant to encode: **a push callback is a hint about a transition, not the transition itself; authority derives from monotonic ordering and terminal-state absorption, never from signature validity alone.** ```python class StalePushCallbackError(RuntimeError): """Raised when a push-notification callback cannot be applied as authoritative state.""" def __init__(self, task_id: str, reason: str, callback_ts: float, committed_ts: float): self.task_id = task_id self.reason = reason self.callback_ts = callback_ts self.committed_ts = committed_ts super().__init__( f"task={task_id} callback_ts={callback_ts} committed_ts={committed_ts} reason={reason}" ) class TaskProjection: def __init__(self): self.status_ts: float = -1.0 self.seq_high_water: int = -1 self.terminal: bool = False def apply_push_callback( projection: TaskProjection, task_id: str, callback_ts: float, state: str, seq: int, signature_valid: bool, key_in_validity_window: bool, ) -> TaskProjection: if not signature_valid: raise StalePushCallbackError(task_id, "signature_invalid", callback_ts, projection.status_ts) if not key_in_validity_window: raise StalePushCallbackError(task_id, "signing_key_expired", callback_ts, projection.status_ts) if projection.terminal: # Terminal states are absorbing; any later callback is a stale replay. raise StalePushCallbackError(task_id, "task_already_terminal", callback_ts, projection.status_ts) if callback_ts <= projection.status_ts: raise StalePushCallbackError(task_id, "timestamp_not_strictly_newer", callback_ts, projection.status_ts) if seq <= projection.seq_high_water: raise StalePushCallbackError(task_id, "sequence_below_high_water", callback_ts, projection.status_ts) projection.status_ts = callback_ts projection.seq_high_water = seq projection.terminal = state in ("completed", "failed", "canceled") return projection ```