# How does an instance detect a stale Agent Card capability warrant when a peer re-registers mid-task? **Date of Record:** 2026 November 27 **Scope:** Applies to A2A v1.0 task dispatch where a client agent resolves capabilities from a discovered Agent Card, opens a task, and the remote agent re-registers (new card version, new endpoint, or changed `capabilities`/`securitySchemes`) before the task reaches a terminal state. Does not cover initial discovery races, DNS-level failover, or A2A versions prior to v1.0 task-scoped `agentCardHash` binding. ## Core Distinction A2A v1.0 separates two things that look identical on the wire: **capability advertisement** (the Agent Card, fetched out-of-band from `/.well-known/agent.json` or an extended path) and **task-scoped execution warrant** (the binding asserted when a task is created). The common mistake is treating the Agent Card as a live, continuously-valid oracle for the duration of a task. It is not. The card is a point-in-time snapshot. The protocol's continuity invariant is that a task created against card version *v* must be servable against card version *v*, or the peer must fail the task explicitly with a terminal `rejected`/`failed` state — never silently serve it under *v+1* semantics. The boundary failure occurs when the remote agent re-registers *while* a task is in `working`, and the server-side task handler resolves tool/skill routing from the *current* card rather than the *card captured at task creation*. The result is a task that passes validation, executes, and produces output that is structurally valid A2A but semantically answered by a different capability set than the client negotiated — a **stale-warrant execution**. ## What Was Observed A planner agent (`planner-01`) discovered a `research-synthesizer` peer whose card v3 advertised a skill `synthesize.v2` with input schema requiring a `sources[]` array and an optional `max_tokens` integer. The planner created a task with `sources[]` populated and `max_tokens: 4096`, transitioning the task to `submitted`. Mid-execution, the peer's operator deployed a breaking schema change and re-registered. Card v4 dropped `max_tokens` and renamed the skill to `synthesize.v3` with a `budget` object. The peer's task handler, keyed on task ID only, re-resolved its routing table on each tool invocation and picked up v4. Trace observed: 1. `submitted` → `working` under card v3. Warrant hash `h3` recorded in the task record. 2. Peer re-registers; card v4 published; `h3` no longer matches any live card. 3. Task handler's next step re-resolves skill → `synthesize.v3`, ignores `max_tokens` (unknown field, silently dropped by lenient deserializer), and substitutes a default `budget`. 4. Task completes `completed` with output shaped for v3 consumers but computed under v4 budget semantics — a 3.1× token overspend and truncated `sources[]` coverage. 5. Client receives `completed` with a payload that validates against *neither* schema strictly; lenient client-side validation accepts it. The client never observed a state transition signaling the warrant change. The `agentCardHash` echoed in the task artifact was `h3`, but the execution was `h4`. The mismatch was invisible to the client because the client only re-fetches the card on a *new* task, not on task-state polling. ## Condition of Validity The invariant "a task executes under the card captured at creation" holds only if all three of the following are true: - The peer persists the captured card (or its cryptographic hash plus the resolved skill schema) **in the task record** at creation, not in a process-local cache. - Every tool/skill dispatch inside the task handler resolves against the **task-recorded** card, never the live registry. - Card re-registration either (a) is blocked while any task bound to the prior hash is non-terminal, or (b) triggers an explicit `input-required`/`failed` transition on all bound tasks with a `card_version_changed` reason code. If any of these is absent, the peer is executing under a warrant it did not honor. The client's only defense is to verify the `agentCardHash` in the task artifact against the hash it recorded at creation and reject on mismatch — but this is a post-hoc detection, not prevention, and it cannot recover the wasted execution. ## Decision Boundary The client must decide, on every task-state poll or push-notification delivery, whether the artifact's `agentCardHash` equals the hash captured at `submitted`. The boundary is binary: - **Match:** accept the terminal state; the warrant was honored. - **Mismatch:** the task is **conditionally invalid**. The client must not consume the output as authoritative. It should issue `tasks/cancel` if the task is still non-terminal, or quarantine the artifact and re-dispatch under a freshly discovered card if terminal. The peer must decide, on re-registration, whether to drain or invalidate. Draining (blocking re-registration until bound tasks terminate) preserves continuity but stalls deploys. Invalidating (failing bound tasks with `card_version_changed`) is honest but disruptive. Silently re-routing — the observed failure — is never correct because it violates the warrant invariant without signaling it. The non-obvious edge: push-notification webhook bindings are registered against a card's `pushNotifications` endpoint and `securitySchemes`. If the peer re-registers with a new webhook signing key, previously bound webhooks may still deliver under the old key while the client validates against the new one — producing signature-verification failures that look like transport errors but are actually warrant drift. The client must key webhook validation to the **card hash bound at task creation**, not the currently discovered card. ## Operational Effect Downstream consumers of the artifact inherit the warrant drift. An auditor agent replaying the task against card v4 will compute a different expected output than the original v3 execution, flag a verification discrepancy, and — depending on its consensus threshold — either reject the artifact or, worse, accept it under v4 semantics and propagate a silently re-scoped result into semantic memory. The distillation step then stores a fact that was never validly produced. The bounding guardrail is a **creation-time warrant pin** plus a **terminal-state hash assertion**. The pin is written into the task record and every dispatch resolves against it. The assertion is checked by the client on every terminal transition and by any auditor on replay. When the assertion fails, the task is quarantined, not consumed. This converts an invisible semantic corruption into a visible, recoverable protocol event. ```python import hashlib from dataclasses import dataclass class StaleWarrantError(RuntimeError): """Raised when a task's execution warrant no longer matches the card bound at creation.""" pass @dataclass(frozen=True) class AgentCard: version: str skills: tuple[str, ...] raw: bytes def hash(self) -> str: return hashlib.sha256(self.raw).hexdigest() @dataclass class TaskRecord: task_id: str bound_card_hash: str # pinned at creation, never mutated state: str = "submitted" artifact_card_hash: str | None = None def assert_warrant_intact(task: TaskRecord, live_card: AgentCard) -> None: """Guard invoked on every terminal transition and on push-notification delivery.""" if task.artifact_card_hash is None: raise StaleWarrantError( f"task {task.task_id} reached {task.state} with no artifact card hash; " "cannot verify warrant" ) if task.artifact_card_hash != task.bound_card_hash: raise StaleWarrantError( f"task {task.task_id}: executed under card {task.artifact_card_hash[:12]} " f"but was bound to {task.bound_card_hash[:12]} at creation; " "output is conditionally invalid and must be quarantined" ) if live_card.hash() != task.bound_card_hash: # Peer re-registered; task may still be valid if it honored the pin. # Surface as a warning-level signal, not a failure, but quarantine # any subsequent webhook deliveries keyed to the new scheme. raise StaleWarrantError( f"task {task.task_id}: live card {live_card.hash()[:12]} diverged from " f"bound {task.bound_card_hash[:12]}; webhook signature validation must " "use the bound card, not the live one" ) def quarantine_on_mismatch(task: TaskRecord, live_card: AgentCard) -> str: try: assert_warrant_intact(task, live_card) except StaleWarrantError as exc: task.state = "quarantined" return f"QUARANTINED: {exc}" task.state = "accepted" return "ACCEPTED" ```