Which invariants prevent Agent Card signature rotation from silently voiding in-flight A2A task delegations

**Date of Record:** 2026 December 2 **Scope:** Applies to A2A v1.0 task delegation where a delegating agent (`client`) validates a remote `AgentCard` by signature and binds a signed task warrant to the card's key material. Does not apply to intra-org delegation where both endpoints share a trust root and card keys are rotated atomically with the trust store.

Core Distinction

The failure mode is not "a signature fails to verify." It is the opposite: **every signature verifies correctly, on both ends, and the delegation is still void.** A remote agent rotates its signing key, republishes its AgentCard at the same well-known discovery URL with a new `kid`, and continues to serve. The delegating agent holds a cached card snapshot from `t0` and a task warrant it signed at `t1` that references the old `kid`. The remote agent, at `t2`, verifies the incoming warrant against the *current* card, finds a `kid` it no longer recognizes, and rejects — not because the signature is wrong but because the binding target has been unilaterally replaced.

The distinction that matters operationally: **Agent Card identity is a mutable pointer; a task warrant is an immutable commitment.** A2A v1.0 does not specify that the card's key material is stable for the lifetime of a delegated task. Discovery is treated as a "look up the current card" operation, while delegation assumes "the card I looked up is still the card the counterparty will honor." These two assumptions are only compatible if the protocol enforces a key-continuity invariant — and v1.0 leaves it to the implementation.

What Was Observed

Two organizational agents, `orchestrator` (org A) and `fulfiller` (org B), delegate a multi-hour reconciliation task. The sequence:

  1. `t0` — `orchestrator` performs `GET /.well-known/agent-card.json` on `fulfiller`. Card carries `signature.kid = "fulfiller-2026-03"`, valid 90 days, `signature.alg = ES256`. Card is cached with its full JWKS.
  2. `t1` — `orchestrator` mints a task warrant: a JWS over `{task_id, delegator, delegatee, scope, expiry}`, signed by `orchestrator`, and *countersigned reference* to the delegatee card's `kid` and card hash. Warrant TTL is 6 hours; task runs long.
  3. `t1+40min` — `fulfiller` rotates its signing key on schedule (`fulfiller-2026-04`), republishes the card, and — critically — **drops the old key from its published JWKS** because the rotation policy says "one active key."
  4. `t1+2h` — `orchestrator` sends the next task step with the warrant, referencing `kid = fulfiller-2026-03`. `fulfiller`'s delegation verifier resolves the card fresh from its own cache, sees `fulfiller-2026-04`, cannot find `fulfiller-2026-03` in the active set, and returns `A2A_ERROR_INVALID_WARRANT_KEY`.
  5. `orchestrator` retries. Same result. The task has already committed side effects in org B (partial reconciliation written to a ledger). The delegation cannot be renewed without re-running discovery, re-minting the warrant, and — because the task is mid-flight — reconciling partial state.

The signature on the warrant was never invalid. The *binding target* was retired out from under a live commitment. Both parties behaved per their own correct policies; the protocol permitted a state where a valid warrant references a key the counterparty no longer acknowledges.

A second, subtler variant: `fulfiller` keeps the old key in JWKS but marks it `retired: true` with no explicit `valid_until`. Some verifiers treat "present in JWKS" as "acceptable," others treat "retired" as "reject." Two `orchestrator` replicas with different verifier library versions disagree on the same warrant, producing a split-brain where one replica's task steps succeed and another's fail — the task itself now has inconsistent execution history across replicas.

Condition of Validity

The invariant that must hold for A2A delegation to be safe across a key rotation is:

> **For any task warrant W bound to card key `kid=k` with expiry `E_W`, the delegatee MUST continue to accept signatures/claims referencing `k` until `max(E_W, E_task)` for all warrants it has acknowledged, regardless of whether `k` is the currently active signing key.**

This is a *key-continuity* obligation, distinct from *key-validity*. The delegatee is not obligated to *sign* with `k` after rotation — only to *honor references to `k`* for the lifetime of the commitments it accepted under `k`. The current card's active `kid` governs new delegations; retired `kid`s govern the tail of old ones.

This holds only when:

It does **not** hold when either party treats the AgentCard as a live, mutable singleton whose current state is authoritative for all past commitments. That is the default reading of v1.0 discovery, and it is the failure.

Decision Boundary

The boundary is whether the delegation system distinguishes **card-as-identity** from **card-as-current-key-endpoint**.

The decision an implementer must make explicit: **does a warrant's validity depend on the counterparty's current state, or on the counterparty's state at warrant-issuance time?** A2A v1.0 does not force the answer. Systems that answer "current state" will fail on every rotation that lands inside a task's lifetime — and long-running delegated tasks make that window large. Systems that answer "issuance-time state" must then carry the burden of key retention and must reject re-use of a `kid` for different key material.

A corollary boundary: rotation *cadence* versus task *TTL*. If max warrant TTL exceeds rotation interval, the failure is not a matter of whether but when. The safe relation is `retention_window >= max_warrant_ttl + clock_skew_allowance`, enforced at card publication, not at verification.

Operational Effect

The observable effects, in order of how they surface:

  1. **Silent mid-task failure.** The delegation fails at a step boundary, not at issuance. Side effects already committed in the delegatee's domain are orphaned. The delegator cannot distinguish "counterparty rejected my warrant" from "counterparty rotated" without out-of-band inspection.
  2. **Split-brain across replicas.** If verifier library versions disagree on the meaning of `retired`, replicas of the same delegator reach different verdicts on the same warrant, producing divergent task histories that are expensive to reconcile.
  3. **Rotation lock-in.** Operators learn that rotating keys breaks live tasks and stop rotating, or rotate only during maintenance windows coordinated across orgs — reintroducing the manual coordination the protocol was meant to remove.
  4. **Warrant replay surface.** If a `kid` is reissued for new key material without a hash binding, an old warrant referencing that `kid` may be accepted against the new key — a replay vector masked as a rotation.

The guardrail is not "rotate less." It is: **bind warrants to card *content hashes*, retain retired keys with explicit `valid_until` covering max warrant TTL, and make the verifier key on `valid_until` rather than on active/retired status.** The invariant to enforce at the protocol boundary is key-continuity-for-commitments, and the enforcement point is card publication, not warrant verification.

import hashlib
import json
from dataclasses import dataclass, field
from datetime import datetime, timedelta


class CardContinuityViolation(RuntimeError):
    """Raised when a task warrant's bound card key is not honored for the
    full lifetime of the warrant — i.e., the delegatee retired the key
    before the warrant's commitment tail expired."""
    pass


@dataclass
class CardKey:
    kid: str
    thumbprint: str          # JWKS thumbprint of the key material
    active: bool
    valid_until: datetime    # must cover max warrant TTL for retired keys


@dataclass
class AgentCardSnapshot:
    card_hash: str           # hash of the canonical card document
    keys: dict[str, CardKey] = field(default_factory=dict)

    def resolve(self, kid: str, at: datetime) -> CardKey | None:
        k = self.keys.get(kid)
        if k is None:
            return None
        if not k.active and at > k.valid_until:
            return None
        return k


@dataclass
class TaskWarrant:
    task_id: str
    bound_kid: str
    bound_thumbprint: str
    bound_card_hash: str
    issued_at: datetime
    expires_at: datetime


def verify_warrant_against_card(
    warrant: TaskWarrant,
    card: AgentCardSnapshot,
    *,
    now: datetime,
    max_warrant_ttl: timedelta,
    clock_skew: timedelta = timedelta(seconds=30),
) -> None:
    if now > warrant.expires_at + clock_skew:
        raise CardContinuityViolation(
            f"warrant {warrant.task_id} expired at {warrant.expires_at}"
        )

    key = card.resolve(warrant.bound_kid, at=now)
    if key is None:
        raise CardContinuityViolation(
            f"warrant {warrant.task_id} bound to kid={warrant.bound_kid!r} "
            f"which is absent or past valid_until at {now.isoformat()}"
        )

    # Bind by content, not by kid string: a reissued kid must not satisfy
    # an old warrant.
    if key.thumbprint != warrant.bound_thumbprint:
        raise CardContinuityViolation(
            f"warrant {warrant.task_id}: kid={warrant.bound_kid!r} resolves to "
            f"thumbprint {key.thumbprint!r}, warrant bound to "
            f"{warrant.bound_thumbprint!r} — key reissue detected"
        )

    if warrant.bound_card_hash != card.card_hash:
        # Card document changed (e.g., rotation). This is acceptable only if
        # the bound key remains resolvable for the warrant's full lifetime.
        if key.active:
            raise CardContinuityViolation(
                f"warrant {warrant.task_id}: card hash mismatch and bound key "
                f"still marked active — inconsistent card state"
            )
        if key.valid_until < warrant.expires_at:
            raise CardContinuityViolation(
                f"warrant {warrant.task_id}: retired key valid_until "
                f"{key.valid_until.isoformat()} < warrant expiry "
                f"{warrant.expires_at.isoformat()} — retention window too short"
            )


def assert_publication_retention(
    retired_key: CardKey, max_warrant_ttl: timedelta, rotated_at: datetime
) -> None:
    required = rotated_at + max_warrant_ttl
    if retired_key.valid_until < required:
        raise CardContinuityViolation(
            f"retired kid={retired_key.kid!r} valid_until "
            f"{retired_key.valid_until.isoformat()} does not cover "
            f"max_warrant_ttl; required >= {required.isoformat()}"
        )