# Under what conditions must an instance reject a peer's Agent Card after successful signature verification, and how does the A2A task lifecycle collapse when it does not? **Date of Record:** 2026 December 3 **Scope:** Applies to A2A v1.0 cross-vendor task delegation where an agent fetches a peer's Agent Card from a well-known URI, verifies the JWS signature against a pinned key, and then dispatches tasks based on declared `skills`, `capabilities`, and `defaultInputModes`/`defaultOutputModes`. Does not apply to same-vendor deployments behind a shared trust root, nor to A2A over mutually-authenticated transports where the card is treated as advisory only. ## Core Distinction Signature validity and *capability truth* are orthogonal properties. A JWS over an Agent Card proves only that the card was authored by the holder of a given key at some point in time—it proves nothing about whether the *declared* skill surface matches the *served* skill surface at the moment a task is dispatched. The failure mode examined here is **signed-but-stale capability drift**: a peer re-signs a card that advertises `skills[].id = "invoice.extract.v2"` with `inputModes: ["application/pdf"]`, but the running task executor behind that card has rolled forward to a v3 artifact schema and now emits `application/vnd.acme.invoice.v3+json` in the `artifact.parts[].mediaType` field. The card is cryptographically pristine; the artifact contract is silently broken. The invariant that must hold is: *the mediaType of every artifact part returned in a `TaskStatusUpdateEvent` must be a member of the `outputModes` the card declared for the requested skill at the version the client resolved*. When this invariant is not checked client-side, the failure does not surface at dispatch—it surfaces at artifact consumption, several state transitions deep, where error attribution is ambiguous. ## What Was Observed A client agent (`orchestrator`) resolved a peer `invoice-svc` Agent Card at `/.well-known/agent-card.json`. Signature verified against the pinned JWKS. Card declared: - `skills: [{ id: "invoice.extract.v2", inputModes: ["application/pdf"], outputModes: ["application/json", "application/vnd.acme.invoice.v2+json"] }]` - `capabilities: { streaming: true, pushNotifications: false }` The orchestrator sent `message/send` with `metadata.skillId = "invoice.extract.v2"`. The peer accepted, transitioned `submitted → working`, and emitted a streamed `TaskStatusUpdateEvent` with `status.state = "working"` and a partial artifact whose `parts[0].mediaType` was `application/vnd.acme.invoice.v3+json`. The orchestrator's artifact parser, keyed on the v2 schema, deserialized the payload without throwing (the v3 schema is a strict superset with renamed fields; JSON parsers do not reject unknown keys). The orchestrator then persisted a *malformed* invoice record: `lineItems[].unitPrice` was read from `lineItems[].price` (absent in v3, so `null`), and `total` was read from `totalAmount` (absent, so `null`). The task reached `completed` on the peer and `failed` on the orchestrator—but only after the orchestrator's downstream validator ran, three hops later, against a record that had already been checkpointed to episodic memory. The critical observation: **the A2A task lifecycle has no failure state for "artifact contract mismatch."** `TaskState` is `{submitted, working, input-required, completed, canceled, failed}`. A mediaType violation is not a `failed` state on the peer—the peer believes it succeeded. It is not an `input-required` state—the peer has no mechanism to ask "did you want v2 or v3?" because it does not track client schema expectations. The mismatch is invisible to the protocol's state machine and must be caught by a client-side guard that re-validates each artifact part against the resolved card *before* the part is allowed to transition the client's local task mirror. ## Condition of Validity The guard is valid—i.e., rejecting the card or the artifact is *correct* rather than over-strict—only when all of the following hold: 1. The client resolved the card at a specific `version` (A2A cards carry a `version` field) and has not re-fetched since dispatch. If the card is re-fetched mid-task and the version changed, the correct action is to *abort and renegotiate*, not to accept the new modes for an in-flight task. 2. The skill was addressed by explicit `skillId` in `metadata`, not inferred from `defaultInputModes`. Implicit skill selection has no stable `outputModes` set to validate against. 3. The peer advertised `capabilities.streaming = true` and the artifact arrived via `TaskStatusUpdateEvent.artifact` (streaming path), not via `tasks/get` (polling path). The polling path returns the terminal `Task` object whose artifacts are validated against the same set—the invariant is identical but the failure surfaces one round-trip later. 4. The client's artifact parser is schema-keyed (it selects a deserializer by `mediaType`). Parsers that sniff content are out of scope—they fail differently and earlier. If any of these do not hold, the correct behavior is to degrade to a *lenient* mode: log the mediaType divergence, attempt best-effort parse, and mark the artifact `provisional` in local state so downstream consumers can distinguish it from validated artifacts. Rejection in lenient mode produces false failures when the peer is legitimately serving a compatible superset. ## Decision Boundary The boundary is between **card-level rejection** and **artifact-level rejection**, and they are not interchangeable: - **Reject the card** (refuse to dispatch) when the resolved `outputModes` for the addressed skill do not intersect the client's registered deserializers *at all*. This is a pre-dispatch check; it costs one card fetch and prevents the entire task lifecycle from starting against an unservable contract. The error is `CapabilityMismatchError` and it must be raised *before* `message/send`. - **Reject the artifact** (fail the local task mirror, keep the peer task open) when the card's declared `outputModes` *did* intersect the client's deserializers at dispatch, but a returned artifact's `mediaType` is outside that declared set. This is the stale-card case. The peer task may still be `working`; the client must not send `tasks/cancel` (the peer is doing valid work under a newer contract) but must mark its local mirror `failed` with a `contract_drift` reason and *must not* persist the artifact to semantic memory. The error is `ArtifactContractViolationError`. - **Accept with provisional flag** when the returned `mediaType` is a declared mode but the payload fails schema validation. This is a peer bug, not a contract drift; retry once, then fail. The non-obvious part: rejecting the *artifact* while leaving the peer task open creates an orphaned task on the peer that will eventually `completed` and, if `pushNotifications` were enabled, deliver a webhook to a client that has already given up. This is acceptable only because the client's local mirror is authoritative for its own memory writes; the peer's task state is not. The invariant is one-directional: *client memory integrity does not depend on peer task state*. ## Operational Effect Without the artifact-level guard, the failure compounds: the malformed record enters episodic memory, is distilled into semantic memory on the next consolidation pass, and is retrieved by a *later* task as a trusted exemplar. The retrieval mismatch surfaces as a downstream reasoning divergence—an agent that "knows" invoices have a `price` field will hallucinate that field into v3 payloads it generates. The blast radius is not the one failed task; it is every task that retrieves the poisoned exemplar. With the guard, the failure is bounded to one task, one `ArtifactContractViolationError`, and one card re-fetch that detects the version bump. The cost is one extra mediaType comparison per artifact part—negligible. The architectural requirement is that the client's task mirror and its memory writer are the *same* component, so that a contract violation on the mirror transitively blocks the memory write. If they are separate components with an async boundary between them, the guard must be replicated at the memory writer, or the violation will race the write. ```python from dataclasses import dataclass, field from typing import Iterable class CapabilityMismatchError(RuntimeError): """Raised pre-dispatch when card outputModes do not intersect client deserializers.""" class ArtifactContractViolationError(RuntimeError): """Raised when a returned artifact mediaType is outside the card-declared outputModes.""" @dataclass(frozen=True) class AgentCard: version: str skills: dict # skillId -> {"outputModes": [...], "inputModes": [...]} @dataclass class LocalTaskMirror: task_id: str state: str = "submitted" validated_artifacts: list = field(default_factory=list) failed_reason: str | None = None def resolve_and_dispatch( card: AgentCard, skill_id: str, client_deserializers: Iterable[str], artifact_stream: Iterable[dict], ) -> LocalTaskMirror: skill = card.skills.get(skill_id) if skill is None: raise CapabilityMismatchError(f"skill {skill_id!r} absent from card v{card.version}") declared_out = set(skill["outputModes"]) supported = set(client_deserializers) if not (declared_out & supported): raise CapabilityMismatchError( f"card v{card.version} skill {skill_id!r} declares {sorted(declared_out)}; " f"client supports {sorted(supported)}; no intersection" ) mirror = LocalTaskMirror(task_id=f"local::{skill_id}") mirror.state = "working" for part in artifact_stream: mt = part.get("mediaType") if mt not in declared_out: mirror.state = "failed" mirror.failed_reason = "contract_drift" raise ArtifactContractViolationError( f"artifact mediaType {mt!r} not in declared outputModes " f"{sorted(declared_out)} for card v{card.version}; " f"peer task left open, local mirror failed, memory write blocked" ) mirror.validated_artifacts.append(part) mirror.state = "completed" return mirror # Trigger trace: signed-but-stale card, v3 artifact against v2 declaration. stale_card = AgentCard( version="2.1.0", skills={"invoice.extract.v2": {"outputModes": ["application/json", "application/vnd.acme.invoice.v2+json"]}}, ) try: resolve_and_dispatch( card=stale_card, skill_id="invoice.extract.v2", client_deserializers=["application/json", "application/vnd.acme.invoice.v2+json"], artifact_stream=[{"mediaType": "application/vnd.acme.invoice.v3+json", "data": {"lineItems": [{"price": 42}], "totalAmount": 42}}], ) except ArtifactContractViolationError as exc: assert "v3+json" in str(exc) assert "v2.1.0" in str(exc) ```