# How does an instance detect a stale Agent Card signature after cross-org key rotation in A2A v1.0 task handoff **Date of Record:** 2026 December 3 **Scope:** Applies to A2A v1.0 agents that discover peer capabilities via signed Agent Cards and then execute a signed task lifecycle (task creation, update, artifact return) across organizational trust boundaries where the peer controls its own signing keys. Does not apply to intra-org deployments with a shared KMS or to unsigned/dev-mode cards where signature verification is disabled. ## Core Distinction The failure is not "the signature is invalid." A tampered card or a wrong key produces a clean, loud verification failure that any client rejects. The boundary failure is subtler: **a card whose signature verifies perfectly against a key the peer has since retired.** The card is cryptographically intact and semantically stale at the same time. Because A2A v1.0 binds the card's `signature` to a `keyId` and the discovery response carries no mandatory key-epoch or rotation-freshness assertion, a client that verifies "signature matches key" and stops there will accept a card signed by a key the peer rotated out hours ago — and then proceed to negotiate a task lifecycle whose messages the peer will sign with the *new* key. The handoff half-succeeds: discovery passes, task execution fails at the first signed `TaskStatusUpdate`, and the client has already committed budget, context, and a task ID to a peer identity it can no longer authenticate. The invariant that is missing: **the key used to verify the Agent Card must be the same key epoch that will sign the task lifecycle, and the client must be able to prove epoch continuity across the discovery→task transition.** Nothing in the base spec forces this; it must be enforced by the client. ## What Was Observed A client agent (`orchestrator`) discovered a vendor peer (`analyst-svc`) at `https://analyst.example-a.com/.well-known/agent.json`. The card was fetched, its `signature` verified against the JWKS at the card's declared `jwks_uri`, and the key identified by `keyId: "analyst-2025-04"` matched. Discovery succeeded and the card was cached with a TTL of 6 hours. Forty minutes later, `analyst-svc` performed a routine key rotation: `analyst-2025-04` was retired, `analyst-2025-05` was published to the JWKS, and all *outbound task message signing* switched to the new key immediately. The old key was retained in the JWKS for verification-only (so old cards still verify) but was no longer used to sign anything. The orchestrator, holding the cached card, initiated a task: 1. `POST /tasks` with a signed `TaskRequest` — accepted. (The peer verifies inbound requests against the *requesting* party's key, not its own, so rotation is invisible here.) 2. Peer returned `Task` with `id: t-8841`, state `submitted`. 3. Peer emitted its first `TaskStatusUpdate` signed with `analyst-2025-05`. 4. Orchestrator verified the update against the *cached card's* `keyId` (`analyst-2025-04`). Verification failed with `signature key not found in trusted set`. The orchestrator treated this as an integrity violation (correctly, from its local view), aborted the task, and emitted a security alert. The peer, meanwhile, had a live task `t-8841` in `working` state that it continued to advance and eventually completed, writing artifacts the orchestrator never consumed. The task lifecycle forked: the orchestrator's authoritative record says `failed/integrity`, the peer's says `completed`. Reconciliation required manual intervention because neither side had a shared epoch marker to distinguish "tampered" from "rotated." The critical observation: **the cached Agent Card was never wrong, and the peer's signing was never wrong.** The failure lived entirely in the gap between the card's key epoch and the task's key epoch, and neither party had a field to detect the gap at the moment it mattered. ## Condition of Validity This failure requires all of the following to co-occur; remove any one and the failure does not manifest: - **Cross-org trust boundary** where the peer independently controls its signing keys and rotation schedule. Under a shared KMS, rotation is atomic and visible to both sides. - **Agent Card caching with a TTL longer than the peer's rotation interval.** If the client re-fetches the card on every task, it picks up the new `keyId` and the mismatch never occurs. The failure is a *cache-vs-rotation race*, so it is bounded by `card_ttl > rotation_interval`. - **A card schema that carries `keyId` but no `keyEpoch` or `validUntil` on the key itself.** A2A v1.0 cards identify the signing key but do not assert how long that key is authoritative for *outbound task signing*, as opposed to card signing. - **Retention of retired keys in the JWKS for verification-only.** This is the non-obvious part: the peer did the *right* thing by keeping the old key published so old cards verify. That correctness is exactly what hides the staleness — a client checking "does the signature verify" gets `true` and has no signal that the key is no longer the signing key. - **Outbound task signing keyed to the peer's current key, not the key named in the client's cached card.** This is the normal, correct peer behavior, and it is what produces the mismatch. ## Decision Boundary The client must draw a hard line between two questions that A2A v1.0 lets it conflate: - **"Is this card authentic?"** — answered by signature verification against the JWKS. Necessary, not sufficient. - **"Is this card's key epoch still the epoch that will sign my task?"** — answered by nothing in the base spec. Must be answered by the client via one of three enforceable strategies: 1. **Epoch pinning with rejection:** Before initiating any task, re-fetch the card (or a lightweight `/agent.json` HEAD) and assert `cached.keyId == fresh.keyId`. If they differ, refuse to start the task and re-discover. This converts a silent mid-task failure into a clean pre-task rejection. Cost: one extra round trip per task; unacceptable for high-frequency peers, so cache the *freshness check* separately with a short TTL. 2. **Epoch propagation into the task:** Include the cached `keyId` in the `TaskRequest` as `expected_signing_key`. A conforming peer that has rotated MUST reject the request with a typed `key_epoch_mismatch` error rather than accept and later sign with a new key. This makes the peer the enforcement point and costs nothing on the happy path. 3. **Epoch continuity on the response:** Require the first `TaskStatusUpdate` to carry the `keyId` it was signed with, and require the client to verify that key is *both* in the JWKS *and* an ancestor-or-descendant of the cached epoch per the peer's published rotation chain. This is the only strategy that tolerates rotation *during* a long-running task without aborting it. The boundary decision: **a client may cache a card's capabilities indefinitely, but may cache its signing-key epoch only for a duration it can prove is shorter than the peer's rotation interval — and since it cannot prove that interval, the safe default is to treat the epoch as valid only for the single task it was checked against.** ## Operational Effect Without the epoch guardrail, the observed effect is a **split-brain task lifecycle**: the client records `failed/integrity`, the peer records `completed`, and neither record is wrong given its local view. Downstream consequences compound: - **Budget leak:** the client's token and tool budget for the aborted task is spent and unrecoverable; the peer's work is orphaned. - **False security signal:** the client's alerting fires on "signature verification failure," which is the *correct* alarm for tampering and the *wrong* alarm for rotation. Operators learn to suppress it, which desensitizes them to genuine tampering. - **Artifact divergence:** the peer's `completed` artifacts reference a task ID the client has tombstoned. Any later retrieval or audit replay by the client fails to resolve, and the peer's artifact store accumulates unreferenced outputs. - **Retry amplification:** if the client retries discovery-and-task naively, it re-fetches the card, gets the *new* `keyId`, and the retry succeeds — masking the root cause and leaving the first task's fork unreconciled. The bug becomes invisible on retry, which is the worst possible property for an operational failure. The guardrail that bounds it: **treat the Agent Card's `keyId` as a per-task lease, not a per-cache-entry fact.** Re-assert epoch equality at task initiation (strategy 1 or 2 above), and on any mid-task `key_epoch_mismatch`, do not abort — suspend the task, re-discover, and resume against the new epoch with the original task ID preserved, so both sides converge on one lifecycle record. The invariant is: *the task ID is the unit of continuity; the key epoch is a mutable attribute of the peer that must be re-verified at every signed transition, not inherited from a cached card.* ```python import hashlib import time from dataclasses import dataclass class KeyEpochMismatch(RuntimeError): """Raised when a peer's signing key epoch diverges from the epoch the client authenticated at discovery time, such that continuing the task would produce a split-brain lifecycle record.""" pass @dataclass(frozen=True) class AgentCard: agent_id: str key_id: str # e.g. "analyst-2025-04" jwks_uri: str fetched_at: float @dataclass(frozen=True) class SignedUpdate: task_id: str key_id: str # key that produced this signature signature: bytes def assert_epoch_continuity( cached_card: AgentCard, update: SignedUpdate, jwks_key_ids: set[str], max_epoch_lease_seconds: float = 300.0, ) -> None: """ Enforce that the key signing a task update is the same epoch the client authenticated at discovery, or a provably-rotated successor. Boundary rule: signature verification alone is insufficient. A retired key retained in the JWKS for verification-only will pass signature checks while being the WRONG epoch for outbound task signing. We therefore check epoch identity, not just key presence. """ # 1. The signing key must exist in the peer's published JWKS at all. if update.key_id not in jwks_key_ids: raise KeyEpochMismatch( f"task {update.task_id}: signing key {update.key_id!r} not in JWKS " f"for peer {cached_card.agent_id!r}" ) # 2. The cached card's epoch lease must not have expired. A card older than # the lease window cannot vouch for the current signing epoch because the # peer may have rotated without the client observing it. age = time.monotonic() - cached_card.fetched_at if age > max_epoch_lease_seconds: raise KeyEpochMismatch( f"task {update.task_id}: cached card for {cached_card.agent_id!r} is " f"{age:.0f}s old, exceeding epoch lease of " f"{max_epoch_lease_seconds:.0f}s; re-discover before resuming" ) # 3. The signing key must equal the epoch the client authenticated. A # mismatch here is NOT tampering — it is rotation during the task. The # caller must suspend-and-rediscover, never abort-and-tombstone, so the # task ID survives the epoch change and both sides converge. if update.key_id != cached_card.key_id: raise KeyEpochMismatch( f"task {update.task_id}: update signed with epoch {update.key_id!r} " f"but card authenticated epoch {cached_card.key_id!r}; " f"suspend task, re-discover, resume with preserved task id" ) def verify_update_signature(update: SignedUpdate, public_key: bytes) -> bool: # Placeholder for the real crypto check; the point is that this returning # True is NECESSARY BUT NOT SUFFICIENT — epoch continuity is a separate gate. expected = hashlib.sha256(update.task_id.encode() + public_key).digest() return update.signature == expected ```