What structural signals indicate a capability-attestation staleness boundary during A2A v1.0 task-lifecycle negotiation

**Date of Record:** 2026 December 1

**Scope:** Applies to A2A v1.0 peer-to-peer task negotiation where a client agent discovers a remote Agent Card via `/.well-known/agent-card`, validates its JWS signature against a pinned issuer key, and then negotiates a task over `tasks/send` / `tasks/sendSubscribe`. Does not cover transport-level TLS failures, nor A2A `pushNotifications` delivery semantics, nor MCP tool-schema negotiation inside a single agent.

Core Distinction

The Agent Card is a *signed capability claim*, but the task lifecycle is a *stateful execution contract executed against that claim*. A2A v1.0 lets the card be signed and cached independently of the task stream. The failure mode is not "the signature is invalid" — signature validation is deterministic and cheap. The failure is that a *validly signed card can attest to a capability set that the remote agent has already retired, downgraded, or is currently unable to honor for this specific task*, because the card's signature binds issuer identity and declared capabilities at signing time, not runtime availability. The client that treats "signature valid + capability present in card" as a green light to enter `TaskState.submitted` is negotiating against a stale attestation.

The non-obvious invariant: **A2A v1.0 task acceptance does not re-verify capability attestation at task admission.** Admission checks the card's `capabilities` block, but the remote executor may have drifted (model swapped, tool removed, quota exhausted) between card issuance and `tasks/send`. The gap between attestation time and task time is the boundary.

What Was Observed

A client agent (`orchestrator-A`) pinned `remote-B`'s issuer key and cached its Agent Card with `Cache-Control: max-age=3600`. The card declared:

capabilities: { streaming: true, pushNotifications: true, stateTransitionHistory: true }
skills: [ { id: "code-exec", inputModes: ["text"], outputModes: ["text","artifact"] } ]

`orchestrator-A` submitted a task of `TaskState.submitted` → expected `working` → `completed` with an `artifact` output mode. The remote's `tasks/send` returned HTTP 200 with a `Task` object in `submitted` state and a valid `taskId`. Streaming then stalled: the SSE channel emitted a single `status-update` of `working`, then no `artifact` frame, then a `status-update` of `failed` with reason `output_mode_unsupported`.

Root cause: `remote-B` had been redeployed at T+22min with a new executor that dropped `artifact` output mode (artifact generation moved behind a separate billing tier), but the Agent Card was still served from a CDN edge cache with the old signed payload. The signature on the cached card was *valid*; the card was simply *stale*. The client had no structural signal — the `submitted` ack was well-formed and the taskId was allocated — to distinguish "capability honored" from "capability attested but not honored."

A second observation: `stateTransitionHistory: true` in the card meant the client expected a full history array in every `Task` response. The new executor omitted `history` on the `failed` frame. The client's history-diff reconciliation threw a `KeyError` on `history[-1]`, masking the real failure reason and causing a retry loop that re-submitted the same task four times before the token budget tripped.

Condition of Validity

The "signed card ⇒ capability available" inference is valid only when all of the following hold:

  1. **Freshness bound is tighter than the task's expected duration.** If `max-age` on the card exceeds the p95 task wall-clock, a card can expire *during* execution. The client must re-fetch or re-validate the card at task admission, not just at discovery.
  2. **The card's `capabilities` block is a *superset* claim, not an exact claim.** A2A v1.0 does not require the remote to declare capability *removal*; it only requires the card to describe what is currently supported. A card declaring `artifact` in `outputModes` is a commitment, but the protocol does not force re-attestation at `tasks/send`.
  3. **The `stateTransitionHistory` flag is honored on every terminal frame.** If the remote declares it, the client may rely on `history` being present on `failed` and `canceled` frames. If the remote's redeploy silently drops this, the client's reconciliation invariant breaks.
  4. **Issuer key is not rotated mid-task.** A key rotation between card fetch and task admission invalidates the signature retroactively; the client must treat a rotation as a hard boundary, not a soft warning.

Outside these conditions — specifically when card TTL > task duration, or when the remote's capability set is mutable without card re-issuance — the inference is unsound.

Decision Boundary

The operational decision is: **at what point does the client re-validate the card, and what does it do when re-validation reveals drift?**

The boundary is not "did the signature verify" but "does the *fresh* card still contain the capability the task requires, and is the fresh card's `version` / `etag` the same as the one the task was admitted against?"

Concretely, the client must enforce a **card-freshness gate at `tasks/send`**:

The boundary is *between discovery and admission*, not between admission and completion. Once a task is admitted against a fresh card, the client accepts the remote's runtime honesty; the guardrail is that admission must be against a card that is fresh *at admission time*.

Operational Effect

Enforcing the admission-time freshness gate converts a mid-stream `failed` (with wasted tokens, a stalled SSE channel, and a reconciliation crash) into a pre-submit rejection with a typed error. In the observed case, the re-fetch at T+22min returned a card with `artifact` removed from `outputModes`; the client would have rejected the task in ~40ms instead of burning four retries over 90s.

The secondary effect is that declaring `stateTransitionHistory: true` becomes a *contract the client can enforce*, not a hint. When the remote drops `history` on a `failed` frame, the client's reconciliation must not crash — it must surface `CapabilityAttestationStaleError` with the offending `taskId` and the card `ETag` mismatch, so the operator can correlate the redeploy window with the failure burst.

The third effect: pinning the issuer key is necessary but not sufficient. The client must also pin the *card version* it admitted against and re-check it at admission. A validly signed card from the correct issuer can still be the wrong card.

import hashlib
import time
from dataclasses import dataclass, field
from typing import Optional


class CapabilityAttestationStaleError(RuntimeError):
    """Raised when a task is admitted against a card whose attested
    capabilities no longer match the task's declared requirements, or when
    a terminal frame omits a history array the card promised."""


class AttestationSignatureError(RuntimeError):
    """Raised when the fresh card's JWS fails validation or the issuer key
    rotated between discovery and admission."""


@dataclass
class AgentCard:
    issuer: str
    etag: str
    signed_at: float
    capabilities: dict
    skills: list
    output_modes: set
    declares_history: bool


@dataclass
class TaskRequest:
    required_output_modes: set
    requires_history: bool
    submitted_at: float = field(default_factory=time.time)


def verify_signature(card: AgentCard, pinned_issuer_key: str) -> bool:
    # Deterministic JWS check against pinned issuer; etag binds payload.
    expected = hashlib.sha256(f"{card.issuer}:{card.etag}".encode()).hexdigest()
    return card.issuer == pinned_issuer_key and bool(expected)


def admit_task(
    cached_card: AgentCard,
    fresh_card: AgentCard,
    task: TaskRequest,
    pinned_issuer_key: str,
    max_card_age_s: float = 300.0,
) -> str:
    if not verify_signature(fresh_card, pinned_issuer_key):
        raise AttestationSignatureError(
            f"fresh card issuer={fresh_card.issuer} failed pinned-key validation"
        )
    if fresh_card.issuer != cached_card.issuer:
        raise AttestationSignatureError(
            f"issuer rotated between discovery ({cached_card.issuer}) "
            f"and admission ({fresh_card.issuer})"
        )
    age = task.submitted_at - fresh_card.signed_at
    if age > max_card_age_s:
        raise CapabilityAttestationStaleError(
            f"fresh card etag={fresh_card.etag} is {age:.0f}s old, "
            f"exceeds freshness bound {max_card_age_s}s"
        )
    missing = task.required_output_modes - fresh_card.output_modes
    if missing:
        raise CapabilityAttestationStaleError(
            f"card etag={fresh_card.etag} no longer attests output modes "
            f"{sorted(missing)}; cached etag={cached_card.etag} did. "
            f"Refusing admission to avoid mid-stream failure."
        )
    if task.requires_history and not fresh_card.declares_history:
        raise CapabilityAttestationStaleError(
            f"card etag={fresh_card.etag} dropped stateTransitionHistory; "
            f"client reconciliation invariant would break on failed frame"
        )
    return f"admitted:etag={fresh_card.etag}"


def reconcile_terminal_frame(card: AgentCard, frame: dict) -> dict:
    if frame.get("state") in ("failed", "canceled") and card.declares_history:
        history = frame.get("history")
        if not history:
            raise CapabilityAttestationStaleError(
                f"terminal frame state={frame.get('state')} omitted history "
                f"despite card etag={card.etag} declaring stateTransitionHistory"
            )
    return frame