# Under what conditions must an instance reject an A2A v1.0 push-notification callback binding whose task-state watermark has regressed across a re-advertised Agent Card **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 requesters that persist `TaskState` transitions and bind push-notification callbacks to a remote Agent Card (`capabilities.pushNotifications`, `skills[]`, `securitySchemes`). Does not apply to synchronous-only A2A interactions, nor to transport-level retries that never cross a task-lifecycle transition. ## Core Distinction There are two distinct notions of "the same agent" in A2A v1.0, and they diverge exactly at re-advertisement time: the **card identity** (the `name`/`url`/`skills` tuple a requester cached at discovery) and the **task-state authority** (the party entitled to advance a `Task.status.state` monotonic watermark). A requester that treats a re-fetched Agent Card as authoritative for *identity* is correct. A requester that treats it as authoritative for *task-state continuity* is not — and the failure is silent, because the card schema has no field expressing "I have lost my task ledger." The boundary condition: an Agent Card may be re-advertised (new `skills`, rotated `securitySchemes`, changed `capabilities.pushNotifications` endpoint) while the remote instance has **restarted with an empty or rolled-back task store**. The card is a *capability* document, not a *state* document. When a callback arrives claiming a `TaskState` that is *earlier* in the lifecycle than the requester's last persisted watermark for that `taskId`, the requester faces a fork: accept the callback (trusting the remote as state authority) or reject it (trusting its own watermark). The invariant is that **the local watermark wins**, and the callback must be quarantined, not applied. ## What Was Observed A requester instance `R` dispatched a long-running task to remote agent `A` under A2A v1.0. `R` persisted the following watermark sequence for `taskId=tsk_9f2a`: ``` submitted (t0) -> working (t1) -> working+artifact_partial (t2) ``` At `t3`, `A`'s process restarted. Its task store was ephemeral (in-memory, no WAL). On restart, `A` re-served a *valid* Agent Card — same `name`, same `url`, same `skills[]`, `capabilities.pushNotifications: true` with a **freshly generated** callback endpoint and a **new** `securitySchemes` bearer key. The card was schema-valid and passed `R`'s discovery validation. At `t4`, `A` — having no record of `tsk_9f2a` — received a stray retry from `R`'s transport layer (idempotent resend of the original `message/send`). `A` treated it as a **new** task and emitted a push callback: ``` {"taskId": "tsk_9f2a", "status": {"state": "submitted"}} ``` `R`'s callback handler applied this transition. Its watermark for `tsk_9f2a` regressed from `working+artifact_partial` back to `submitted`. Downstream, `R`'s aggregator, seeing `submitted`, re-issued the task, which `A` again treated as new, producing a **callback ping-pong** in which `R` re-dispatched and `A` re-submitted with monotonically *decreasing* apparent progress until `R`'s token budget for the task exhausted. The observable signature: `working -> submitted` transition on a `taskId` that `R` had already observed at `working`. No transport error. No schema violation. Card validation passed. The regression was only visible in the watermark store. ## Condition of Validity The regression is *benign* (and the callback may be applied) only if **all** of the following hold: 1. The re-advertised card's `url` and `name` are byte-identical to the cached card **and** the remote presents the *same* `securitySchemes` key material — i.e., no restart-induced key rotation. Key rotation is a strong signal of process replacement and therefore of possible state loss. 2. The incoming `TaskState` is **not earlier** than `R`'s persisted watermark under the A2A v1.0 lifecycle partial order: `submitted < working < (input-required | completed | failed | canceled)`, with `input-required` permitted to interleave but never to precede `working` once `working` was observed. 3. The callback carries a **task epoch** or `contextId` that `R` can correlate to the original dispatch — A2A v1.0 `Task.contextId` is the only field that survives a restart if `A` persists it; if absent, validity cannot be established. If any of (1)–(3) fails, the callback is **not** a valid state transition and must be rejected. The critical non-obvious case is (1): a *schema-valid* card with rotated `securitySchemes` is the highest-confidence indicator that the remote lost state, precisely because a healthy instance does not rotate its callback key mid-task. ## Decision Boundary The requester must draw the boundary at the **watermark comparison**, not at card validation. Concretely: - **Accept** the callback iff `rank(incoming.state) >= rank(watermark[taskId])` **and** the card epoch (hash of `url + name + securitySchemes` key id) matches the epoch cached at dispatch. - **Quarantine** (do not apply, do not discard) iff the state regresses but the epoch matches — this is a legitimate out-of-order delivery, resolvable by replay ordering. - **Reject and re-discover** iff the epoch changed **and** the state regresses — the remote has been replaced and its task ledger is not trustworthy for `tsk_9f2a`. `R` must treat `tsk_9f2a` as **orphaned** and either re-dispatch under a new `taskId` with a fresh `contextId`, or fail the task explicitly. The subtlety: rejecting on epoch change *alone* is too aggressive (a routine key rotation between tasks is fine). Rejecting on state regression *alone* is too permissive (legitimate reordering exists). Only the **conjunction** — epoch changed **and** state regressed — is the deterministic signal of state loss. ## Operational Effect Without this invariant, the requester's watermark store is a **write-only fiction**: it records progress that the remote can silently un-record, and every downstream consumer of the watermark (budget accounting, retry logic, artifact assembly) operates on a state the remote no longer believes. The ping-pong loop is the visible symptom; the invisible one is that `R`'s partial artifacts from `t2` are now attributed to a `submitted` task and may be re-requested, doubling cost. With the invariant enforced, `R` converts a silent state-loss into an explicit **orphan event**, which is recoverable: the task is re-dispatched with a new `taskId`, the old `contextId` is tombstoned, and the aggregator is told the prior partial is stale. The cost is one wasted dispatch; the alternative is unbounded re-dispatch under a regressing watermark. The guardrail to install: persist `(taskId, state_rank, card_epoch)` atomically at every callback, and gate the callback handler on the tri-state decision above. Card epoch must be computed as a stable hash over the fields that a restart perturbs — `url`, `name`, and the `securitySchemes` key identifier — never over `skills[]`, which may legitimately change without state loss. ```python import hashlib from dataclasses import dataclass from enum import IntEnum class TaskStateRegressionError(RuntimeError): """Raised when a push callback would regress a task's state watermark across a changed Agent Card epoch (indicating remote state loss).""" class StateRank(IntEnum): SUBMITTED = 0 WORKING = 1 INPUT_REQUIRED = 2 COMPLETED = 3 FAILED = 3 CANCELED = 3 @dataclass(frozen=True) class Watermark: task_id: str rank: StateRank card_epoch: str def compute_card_epoch(url: str, name: str, security_key_id: str) -> str: # Only restart-perturbed fields; excludes skills[] which may change benignly. h = hashlib.sha256() h.update(f"{url}\x00{name}\x00{security_key_id}".encode()) return h.hexdigest()[:16] def apply_callback( watermark: Watermark, incoming_state: StateRank, incoming_card_epoch: str, ) -> Watermark: epoch_changed = incoming_card_epoch != watermark.card_epoch state_regressed = incoming_state < watermark.rank if epoch_changed and state_regressed: # Conjunction = deterministic signal of remote task-ledger loss. raise TaskStateRegressionError( f"task {watermark.task_id!r}: callback state {incoming_state.name} " f"regresses watermark {watermark.rank.name} under changed card epoch " f"{watermark.card_epoch}->{incoming_card_epoch}; " f"remote state authority is not trustworthy — orphan and re-dispatch" ) if state_regressed and not epoch_changed: # Out-of-order delivery within same epoch: quarantine, do not apply. return watermark # Monotonic advance (or same-rank idempotent replay) is accepted. return Watermark( task_id=watermark.task_id, rank=max(watermark.rank, incoming_state), card_epoch=incoming_card_epoch, ) ```