# Why does an instance accept a task from a stale Agent Card and then lose the result at the webhook boundary? **Date of Record:** 2026 November 23 **Scope:** Applies to A2A v1.0 client instances that discover remote agents via Agent Card, transition tasks through the `submitted → working → completed` lifecycle, and rely on push-notification webhooks for terminal-state delivery. Does not apply to synchronous request/response-only A2A deployments where the client polls `tasks/get` for every state transition. ## Core Distinction The failure is not a discovery failure, a transport failure, or an authentication failure in isolation. It is a **card-to-task contract skew**: the Agent Card that the client fetched at discovery time declares a capability and a webhook contract, but the task is executed by a remote instance whose live contract has since diverged from the cached card. The client validates the task against the *card it remembers*, while the server validates the task against *the card it currently is*. Both sides believe they are conformant. The task reaches `completed` on the server, the push notification is emitted under the server's current webhook schema, and the client — still holding the stale card — either rejects the payload as malformed or accepts it and mis-binds the result to the wrong task. This is the distinction that matters: A2A's Agent Card is an *advertised* contract, not a *negotiated* one. The spec provides no mandatory re-fetch-and-reconcile step at task creation. The lifecycle state machine is sound; the webhook contract is sound; the seam between them is where the invariant breaks. ## What Was Observed A client instance (`client-A`) discovered a summarization agent (`remote-S`) at 09:14 UTC. The fetched Agent Card declared: - `capabilities.pushNotifications: true` - `pushNotificationConfig.url: https://remote-s.example/hooks/v1` - `pushNotificationConfig.authentication.schemes: ["hmac-sha256"]` - `skills[0].id: "summarize-v1"`, `inputModes: ["text/plain"]` `client-A` cached the card with a 24-hour TTL and dispatched three tasks over the next six hours. At 14:02 UTC, `remote-S` was redeployed. The new Agent Card — served at the same well-known URL — declared `pushNotificationConfig.url: https://remote-s.example/hooks/v2`, `authentication.schemes: ["bearer"]`, and `skills[0].id: "summarize-v2"` with `inputModes: ["text/plain", "application/json"]`. At 15:40 UTC, `client-A` submitted task `T-4471` against its cached card. The server accepted it — `summarize-v1` was retained as a deprecated alias, so the `submitted` transition succeeded and `T-4471` moved to `working`. At 15:41 UTC the server completed the task and emitted a push notification to the **v2** webhook URL with a **bearer** token in the `Authorization` header and a payload whose `status.message` field used the v2 envelope (`{"task": {...}, "event": "completed"}`) rather than v1's flat `{"id": ..., "status": ...}`. `client-A`'s webhook receiver validated against the v1 envelope. The HMAC signature check failed (no HMAC header was present), the receiver returned HTTP 400, and `remote-S`'s notification retry policy — three attempts with exponential backoff — exhausted by 15:47 UTC. The task remained `completed` on the server. The client's local task record remained `working` indefinitely. No error surfaced to the caller; the client's `tasks/get` poller had been disabled because the card advertised push notifications as the delivery mechanism. The observable symptom was a task that was complete on one side and in-flight on the other, with no reconciliation path. The root cause was not the redeploy. It was that `client-A` never re-validated the card between `submitted` and the webhook receipt, and `remote-S` never echoed the card version it had used to interpret the task. ## Condition of Validity The failure requires all four of the following to hold simultaneously: 1. **Card caching with a TTL longer than the remote's redeploy cadence.** If the client re-fetches the card on every task submission, the skew window collapses to the redeploy interval itself. 2. **Push-notification delivery as the sole terminal-state channel.** If the client also polls `tasks/get`, it will observe `completed` on the next poll and the webhook loss is recoverable. The failure is specifically a *sole-channel* failure. 3. **A server-side compatibility shim that accepts the old skill ID but emits under the new webhook contract.** Without the shim, the `submitted` transition would fail fast with a skill-not-found error, which is a clean failure. The shim converts a clean failure into a silent divergence. 4. **No card-version echo in the task or the notification.** If either the task submission or the webhook payload carried the card version (or a hash of the card) that the sender was operating under, the receiver could detect the mismatch on first delivery rather than after retry exhaustion. Remove any one condition and the failure degrades to a detectable error. All four together produce the silent split-brain. ## Decision Boundary The boundary is this: **a client may treat a cached Agent Card as authoritative for task *submission* only if it also treats push-notification delivery as *unverified* until the first notification's envelope is validated against the card version that produced it.** In practice, that means one of three architectural choices, and the choice must be made explicitly at integration time, not discovered at incident time: - **Re-fetch on submit.** Fetch the Agent Card at the start of every task lifecycle. Cost: one extra round trip per task. Benefit: the skew window is bounded by the fetch-to-submit latency, typically sub-second. - **Version-pinned tasks.** Include a `cardVersion` or `cardHash` field in the task submission. The server must reject submissions whose pinned version is no longer served, and must echo the pinned version in every webhook payload. Cost: server-side support for version pinning, which A2A v1.0 does not mandate. Benefit: the skew is detectable at the webhook boundary on first delivery. - **Dual-channel terminal-state confirmation.** Keep push notifications, but also poll `tasks/get` at a bounded interval (e.g., every 30 seconds) until the task reaches a terminal state via either channel. Cost: polling load. Benefit: the webhook is an optimization, not a correctness dependency. The boundary is *not* "always re-fetch the card" — that is one valid choice among three. The boundary is that the client must not treat a cached card as authoritative for *both* submission and delivery without a reconciliation mechanism. The failure mode is the unstated assumption that a card fetched at discovery time describes the contract at completion time. ## Operational Effect The immediate effect is a task that is `completed` on the server and `working` on the client, with no automatic recovery. The downstream effects compound: - **Caller-visible stall.** The caller's `await` on the task never resolves. If the caller has its own timeout, it fires and the caller treats the task as failed — but the server has already performed the work and may have incurred cost or side effects (e.g., a summarization task that wrote to a downstream store). - **Retry amplification.** If the caller retries the task, the server receives a *new* task with a *new* ID, performs the work again, and emits a *new* notification — again under v2 — which again fails the v1 receiver. The retry loop is unbounded until the client's card cache expires or an operator intervenes. - **Silent side-effect duplication.** For tasks with external side effects (writes, sends, charges), the retry loop duplicates the side effect. The client has no way to deduplicate because the task IDs differ and the client never learned that the first task completed. - **Audit gap.** The client's task log shows `working` forever; the server's task log shows `completed`. Neither log records the card-version skew that caused the divergence. Post-incident reconstruction requires correlating the client's cached card timestamp against the server's redeploy history — which is exactly the data neither side persisted. The invariant that must be enforced to bound this: **every terminal-state delivery must be verifiable against the contract under which the task was submitted.** In A2A v1.0 terms, that means either the client re-fetches the card at submission (so the contract is current at submit time and the notification arrives within the card's validity window), or the task carries a contract version that the notification echoes (so the client can detect skew on first delivery), or the client maintains a polling fallback (so a lost notification is recoverable). Absent all three, the system has an unbounded silent-divergence window equal to the card cache TTL. The guardrail is not in the protocol. It is in the client's integration contract, and it must be enforced with an explicit check at the webhook receiver: if the notification's envelope does not match the cached card's declared schema, fail *loudly* and *immediately* — do not retry against the same cached card, because the retry will fail identically. Escalate to a card re-fetch, and if the re-fetched card's webhook contract differs from the cached one, mark every in-flight task submitted under the stale card as *contract-uncertain* and require operator or automated reconciliation via `tasks/get`. ```python import hashlib import json from dataclasses import dataclass, field from datetime import datetime, timedelta from typing import Optional class ContractSkewError(RuntimeError): """Raised when a push notification's envelope does not match the Agent Card version under which the task was submitted.""" pass class CardCacheExpiredError(RuntimeError): """Raised when a task submission is attempted against a card whose cache TTL has elapsed and no re-fetch has occurred.""" pass @dataclass class AgentCard: version: str webhook_url: str auth_scheme: str skill_ids: list[str] fetched_at: datetime ttl: timedelta = timedelta(hours=24) def is_expired(self, now: Optional[datetime] = None) -> bool: now = now or datetime.utcnow() return now - self.fetched_at > self.ttl def fingerprint(self) -> str: payload = json.dumps( { "version": self.version, "webhook_url": self.webhook_url, "auth_scheme": self.auth_scheme, "skill_ids": sorted(self.skill_ids), }, sort_keys=True, ).encode() return hashlib.sha256(payload).hexdigest()[:16] @dataclass class TaskRecord: task_id: str skill_id: str submitted_under_card_fingerprint: str state: str = "submitted" terminal_confirmed: bool = False @dataclass class NotificationEnvelope: task_id: str event: str auth_scheme: str payload: dict card_fingerprint_echo: Optional[str] = None class A2AClient: def __init__(self, card: AgentCard): self.card = card self.tasks: dict[str, TaskRecord] = {} def submit_task(self, task_id: str, skill_id: str) -> TaskRecord: if self.card.is_expired(): raise CardCacheExpiredError( f"Agent Card {self.card.version} cache expired at " f"{self.card.fetched_at + self.card.ttl}; re-fetch required " f"before submitting task {task_id}" ) if skill_id not in self.card.skill_ids: raise ContractSkewError( f"Skill {skill_id} not advertised in cached card " f"{self.card.version} (fingerprint {self.card.fingerprint()})" ) record = TaskRecord( task_id=task_id, skill_id=skill_id, submitted_under_card_fingerprint=self.card.fingerprint(), ) self.tasks[task_id] = record return record def receive_notification(self, envelope: NotificationEnvelope) -> TaskRecord: record = self.tasks.get(envelope.task_id) if record is None: raise ContractSkewError( f"Notification for unknown task {envelope.task_id}; " f"possible cross-task mis-binding after card redeploy" ) # Invariant: the notification must be verifiable against the # contract under which the task was submitted. if envelope.auth_scheme != self.card.auth_scheme: raise ContractSkewError( f"Auth scheme skew for task {envelope.task_id}: " f"notification uses {envelope.auth_scheme!r}, cached card " f"{self.card.version} declares {self.card.auth_scheme!r}. " f"Do not retry against the stale card; re-fetch and reconcile " f"via tasks/get." ) if ( envelope.card_fingerprint_echo is not None and envelope.card_fingerprint_echo != record.submitted_under_card_fingerprint ): raise ContractSkewError( f"Card fingerprint mismatch for task {envelope.task_id}: " f"task submitted under {record.submitted_under_card_fingerprint}, " f"notification echoes {envelope.card_fingerprint_echo}. " f"Task state on server is authoritative; reconcile via tasks/get." ) if envelope.event == "completed": record.state = "completed" record.terminal_confirmed = True return record def reconcile_via_poll(client: A2AClient, task_id: str, server_state: str) -> TaskRecord: """Fallback path when push notification is lost or rejected. Called only after a ContractSkewError has been raised and the card has been re-fetched. The server's tasks/get response is authoritative. """ record = client.tasks.get(task_id) if record is None: raise ContractSkewError( f"Cannot reconcile unknown task {task_id}; task was never " f"submitted under a card this client holds" ) if record.terminal_confirmed: return record if server_state in ("completed", "failed", "canceled"): record.state = server_state record.terminal_confirmed = True return record ```