# How should an instance validate the "Agent Card Snapshot" invariant when A2A v1.0 task delegation crosses an org boundary mid-lifecycle **Date of Record:** 2026 November 25 **Scope:** Applies to A2A v1.0 task delegation where a client agent (Org A) discovers a remote agent card (Org B) and initiates `tasks/send`, and the remote card's declared capabilities, endpoint, or signing key can change between discovery and task continuation. Does not apply to same-org delegation, nor to stateless single-turn `message/send` calls that complete within one discovery cache TTL. ## Core Distinction The A2A v1.0 spec treats the Agent Card as a discovery artifact: fetch it from `/.well-known/agent.json`, cache it, and use it to route `tasks/send`. The spec's lifecycle model treats a *task* as durable — it has a `taskId`, a `contextId`, and a state machine (`submitted → working → input-required → completed/failed/canceled`). The failure mode lives in the seam between these two models: **the card is treated as immutable for the life of a task, but the spec only guarantees card freshness at discovery time.** A long-running task that enters `input-required`, waits 40 minutes for human approval in Org A, then resumes with `tasks/send` (continuation) is still bound to a card snapshot that Org B may have rotated — new endpoint, new `securitySchemes` key ID, revoked capability, or a `skills` set that no longer includes the skill the task was delegated for. The non-obvious part: the *task* is still valid on Org B's side (the `taskId` persists), but the *client's* cached card no longer authorizes the continuation. The client resumes with a stale `Authorization` header signed under the old key ID; Org B's verifier rejects it with `401`, which the client's retry logic classifies as a transport fault and retries — three times — against a card that will never authenticate again. The task sits in `working` on Org B until its own TTL expires, then flips to `failed` with a reason the client never observes because it gave up. ## What Was Observed Trace from a cross-org delegation harness (Org A client, Org B remote, 30-minute `input-required` window): 1. `t=0` — Client fetches `https://b.example/.well-known/agent.json`. Card declares `securitySchemes.bearer.kid="k-2024-11"`, `skills=[invoice-audit@v3]`, `endpoint=https://b.example/a2a/v1`. Cached with `Cache-Control: max-age=3600`. 2. `t=0` — Client issues `tasks/send` with `skillId=invoice-audit@v3`, `taskId=T-8841`. Org B accepts, transitions to `working`, then to `input-required` at `t=90s` awaiting a human approval artifact. 3. `t=40min` — Human approves in Org A. Client resumes with `tasks/send` continuation carrying `taskId=T-8841` and the **cached** bearer token signed under `kid=k-2024-11`. 4. `t=40min` — Org B rotated its signing key at `t=25min` (routine 30-day rotation, `kid=k-2025-06`). The old `kid` is retained in JWKS for verification of *in-flight* tokens but the card no longer advertises it, and Org B's gateway now rejects continuation tokens whose `kid` is not in the *current* card's `securitySchemes` — a stricter check than JWKS lookup. 5. Result: `401 invalid_token_kid`. Client retry loop: 3 attempts, exponential backoff (1s, 2s, 4s), all fail. Client emits `task.failed(transport_error)`. Org B's task `T-8841` remains in `working` until its 2-hour task TTL, then `failed(no_continuation)`. The invariant that broke: **the client assumed card immutability across the task lifecycle; the server assumed the client would re-fetch on `401`.** Neither assumption is in the spec; both are reasonable defaults; together they produce a silent orphaned task. ## Condition of Validity The failure is bounded by three conditions, all of which must hold: - **Lifecycle gap > card TTL.** If the task completes within the card's `Cache-Control max-age` (or within the client's configured cache TTL), the snapshot is still authoritative and no re-fetch is needed. The failure requires a suspension point (`input-required`, `auth-required`, human-in-the-loop) that exceeds the card TTL. - **Card mutation is capability-affecting, not cosmetic.** A `description` or `documentationUrl` change is harmless. A change to `securitySchemes`, `skills`, `endpoint`, or `capabilities.streaming`/`pushNotifications` invalidates the continuation. The dangerous mutations are exactly the ones that gate authorization or routing. - **Server enforces card-current authorization.** If Org B's gateway verifies tokens against JWKS only (accepting any unexpired `kid`), the stale token still works and the failure does not fire. The failure requires the stricter "token must match current card" policy — which is the *correct* policy for capability revocation, and therefore the one a well-run Org B will adopt. When the gap is short or mutations are cosmetic, the invariant "card is stable for task lifetime" holds empirically and clients can safely cache. When the gap is long and mutations are authorization-relevant, the invariant silently inverts. ## Decision Boundary The operational decision is: **on task continuation, does the client trust the cached card or re-validate it?** The boundary is a function of two variables — the task's suspension duration and the card TTL — and the correct rule is not "always re-fetch" (too expensive, and `/.well-known` is not designed for per-continuation traffic) nor "never re-fetch" (produces the orphan above). The bounded rule: - If `now - card_fetched_at < min(card_TTL, task_suspension_budget)`, trust cache. - If the continuation returns `401`/`403` with a `kid` or `scheme` mismatch, **do not retry the same credential**. Re-fetch the card, and if the card's `securitySchemes` changed, re-sign and retry exactly once. - If the re-fetched card's `skills` no longer contains the `skillId` the task was delegated for, **abort the continuation and emit `task.canceled(capability_revoked)`** rather than resuming a task whose authorization basis no longer exists. - If the re-fetched card's `endpoint` changed, the task `taskId` is likely invalid on the new endpoint — treat as `task.failed(endpoint_migrated)` and require re-discovery + re-submission, not blind retry. The guardrail is a **card-generation token**: the client binds each task to the card's `etag`/`kid`/`skills-hash` at submission, and on resume compares. Mismatch on authorization-relevant fields is a hard stop, not a retry. ## Operational Effect Without the guardrail, the observed effect is a class of *orphaned tasks* — client believes the task failed (transport), server believes the task is still live (working), and neither side reconciles. In a multi-tenant deployment this leaks: Org B's task table accumulates `working` tasks whose clients have abandoned them, inflating resource accounting and, if the task holds a lock on a shared resource (an invoice record, a document), blocking subsequent delegations. The `contextId`-scoped concurrency limit (A2A v1.0 §7.3) then throttles the *client's* future tasks against Org B because the orphan still counts against the context. With the guardrail, the failure becomes observable and bounded: the client re-fetches on `401`, sees the `kid` rotation, re-signs, and resumes — or, if the skill was revoked, cancels cleanly and Org B's task TTL reclaims `T-8841` immediately on `tasks/cancel`. The difference is not "does the card change" (it will) but "does the client have a defined transition when it does." ## Code ```python class CardSnapshotMismatch(RuntimeError): """Raised when a resumed A2A task's cached card snapshot no longer authorizes continuation against the remote's current card.""" pass AUTH_RELEVANT_FIELDS = ("securitySchemes", "skills", "endpoint", "capabilities") def resume_task(cached_card: dict, task_id: str, skill_id: str, sign_fn) -> dict: # 1. Attempt continuation with cached credential. resp = _post(cached_card["endpoint"], { "taskId": task_id, "auth": sign_fn(cached_card["securitySchemes"]["kid"]), }) if resp.status not in (401, 403): return resp # 2. Auth failure: re-fetch card, compare auth-relevant fields. fresh = _get_well_known(cached_card["endpoint"]) for field in AUTH_RELEVANT_FIELDS: if fresh.get(field) != cached_card.get(field): # Authorization basis changed mid-lifecycle. if skill_id not in [s["id"] for s in fresh.get("skills", [])]: raise CardSnapshotMismatch( f"skill {skill_id} revoked between discovery and resume " f"of task {task_id}; aborting continuation" ) if fresh.get("endpoint") != cached_card.get("endpoint"): raise CardSnapshotMismatch( f"endpoint migrated for task {task_id}; " f"taskId not portable across endpoints" ) # Same endpoint, skill still present, only key rotated: re-sign once. new_kid = fresh["securitySchemes"]["kid"] resp = _post(fresh["endpoint"], { "taskId": task_id, "auth": sign_fn(new_kid), }) if resp.status in (401, 403): raise CardSnapshotMismatch( f"re-signed under kid={new_kid} still rejected for {task_id}" ) return resp # Auth-relevant fields identical but still 401: credential itself is bad. raise CardSnapshotMismatch( f"card unchanged but continuation of {task_id} rejected; " f"credential invalid, not a snapshot issue" ) ```