What happens when an instance trusts a cached Agent Card past its capability epoch: A2A discovery staleness versus task-lifecycle terminality

**Date of Record:** 2026 December 1

**Scope:** Applies to A2A v1.0 deployments where a client agent caches a remote `AgentCard` (from `/.well-known/agent.json` or the registry) and reuses it across task submissions while the remote agent mutates its advertised skills, artifact MIME types, or `capabilities.streaming`/`pushNotifications` flags. Does not cover initial discovery handshake failures or transport-level TLS errors, which fail loudly and are out of scope.

Core Distinction

The failure is not "the card is stale." It is that A2A's task lifecycle and A2A's capability advertisement are two independently versioned state machines that the spec never binds together with a monotonic fence. A task moves `submitted → working → input-required → completed|failed|canceled`. An AgentCard mutates out-of-band, with no epoch in the task envelope. The client's cached card is a *capability snapshot*; the server's live handler is a *capability epoch*. When the epoch advances between the client's cache fill and the task's `artifacts` emission, the client negotiates against a schema that no longer exists, but the task itself still reaches a terminal `completed` state — so the conformance violation is *silent and terminal*, not a retryable error. The dangerous case is precisely the one where the server succeeds: `completed` with an artifact the client cannot parse under its cached contract.

What Was Observed

A procurement agent (vendor A) discovered a document-extraction agent (vendor B) at T0. Cached card advertised one skill, `extract`, with `outputModes: ["application/json"]` and artifact schema `schemaVersion: "1.2"`. At T0+40min, vendor B shipped `schemaVersion: "1.3"`, which renamed `pages[].blocks` to `pages[].segments` and moved `confidence` from block-level to page-level. The card's `version` field was bumped to `1.3.0`; the `skills[].outputModes` stayed `application/json` (the MIME type is identical — the *shape* changed, and A2A cards do not carry a resolvable schema URI for artifact payloads, only a free-text `description`).

Vendor A submitted a task at T0+55min using its cached card. The server accepted (`submitted`), ran (`working`), and returned `completed` with artifacts conforming to 1.3. Vendor A's validator, keyed to 1.2, found `pages[].blocks` absent, treated the artifact as empty, and recorded a *successful* extraction with zero blocks. The task's terminal state was `completed`; the artifact was structurally valid JSON; no protocol error was raised anywhere in the chain. The downstream reconciliation job only caught the discrepancy six hours later when a human noticed empty summaries.

A second, sharper instance: a streaming client cached `capabilities.streaming: false` from a card fetched during a canary window. It therefore never opened the SSE channel and polled `tasks/get` instead. The remote agent, now streaming-capable, buffered artifact chunks behind the SSE backpressure window and only flushed the final `completed` frame — which the polling client received, but with `artifacts` omitted because the server had already delivered them over the (never-opened) stream. Result: `completed`, zero artifacts, no error. Terminal-state conformance failure again.

Condition of Validity

The invariant that must hold — and that A2A v1.0 does not enforce — is:

> **For any task that reaches a terminal state, the artifact schema the client validates against MUST be the schema the server emitted against, and the capability flags the client used for transport selection MUST match those the server honored for that task.**

This holds only if one of the following is true: (a) the client re-fetches the AgentCard and compares `version` before *every* task submission (cache TTL = 0); (b) the task envelope carries a `cardVersion`/epoch the server rejects on mismatch with a non-terminal `input-required`; or (c) the server emits artifacts with an inline, resolvable schema reference and the client validates against *that*, not its cache. A2A v1.0 specifies none of these as mandatory. The `AgentCard.version` field is advisory; the task object has no `cardEpoch`; artifact `parts` carry `mimeType` but no schema identifier. So the invariant is *conditionally valid only under client-side discipline that the protocol does not require*.

Decision Boundary

The boundary is the **cache-fill-to-terminal-state window** versus the **capability mutation window**. If `cache_fill_time + cache_ttl < mutation_time`, the client is safe. If `mutation_time < cache_fill_time + cache_ttl < task_terminal_time`, the client is in the silent-failure zone: the task will complete against a schema it cannot validate. The decision rule an operator must encode:

The hard boundary: any terminal state reached without an artifact-schema match against the *emitting* epoch is a conformance violation regardless of the `completed` status. The protocol will not tell you; the validator must.

Operational Effect

The operational consequence is that A2A task success and artifact conformance are *decoupled*, and the decoupling is invisible in the task state machine. A monitoring system watching `task.status.state` will report 100% success while the artifact pipeline silently drops payloads. The remediation is to add a **conformance gate downstream of terminality**: every artifact is re-validated against a schema resolved at emission time, and any artifact whose schema cannot be resolved is quarantined as a `ConformanceViolation`, not accepted. This converts a silent terminal failure into a loud, retryable one — at the cost of occasional false quarantines when a vendor legitimately omits schema metadata. The trade is correct: a quarantined artifact is recoverable; a silently-empty one is not.

The following guardrail encodes the boundary as an enforced invariant at the client's artifact-ingest step.

import json
from dataclasses import dataclass


class ArtifactSchemaConformanceError(RuntimeError):
    """Raised when a terminal A2A task yields artifacts that cannot be
    validated against the schema epoch the client actually negotiated.
    This is a fail-closed guard: an unresolvable schema is a violation,
    not a default-to-empty."""
    pass


@dataclass
class CachedCard:
    version: str
    output_modes: list[str]
    schema_version: str | None  # None if card carried no resolvable schema


def ingest_terminal_artifacts(
    task: dict,
    cached_card: CachedCard,
    live_card_version: str,
) -> list[dict]:
    # Invariant 1: terminality does not imply conformance.
    if task.get("status", {}).get("state") != "completed":
        raise ArtifactSchemaConformanceError(
            f"task {task.get('id')} not terminal-completed; refusing ingest"
        )

    # Invariant 2: capability epoch must match at terminal time.
    if live_card_version != cached_card.version:
        raise ArtifactSchemaConformanceError(
            f"capability epoch drift: cached={cached_card.version} "
            f"live={live_card_version}; artifacts may target a different schema"
        )

    artifacts = task.get("artifacts") or []

    # Invariant 3: a completed task with zero artifacts is a silent-loss
    # signature, not a valid empty result, unless the card declares it.
    if not artifacts:
        raise ArtifactSchemaConformanceError(
            f"task {task.get('id')} completed with zero artifacts and no "
            f"declared empty-result mode; suspected stream-backpressure loss"
        )

    validated: list[dict] = []
    for art in artifacts:
        emitted_schema = art.get("schemaVersion") or art.get("$schema")
        if emitted_schema is None:
            raise ArtifactSchemaConformanceError(
                f"artifact {art.get('artifactId')} carries no resolvable "
                f"schema; fail-closed rather than validate against cache"
            )
        if cached_card.schema_version and emitted_schema != cached_card.schema_version:
            raise ArtifactSchemaConformanceError(
                f"artifact schema {emitted_schema} != negotiated "
                f"{cached_card.schema_version}; silent shape change"
            )
        validated.append(art)

    return validated