# Why does an instance accept a delegated task against a stale Agent Card and then deadlock on capability mismatch **Date of Record:** 2026 November 26 **Scope:** Applies to cross-org A2A v1.0 delegation where the caller resolves the callee via `/.well-known/agent-card.json`, caches the card, and later dispatches a `tasks/send` envelope whose `skillId` / `inputModes` / `securitySchemes` were negotiated against that cached card. Does not apply to same-org delegation where card and callee are co-deployed and versioned atomically, nor to synchronous single-turn request/response without a task lifecycle. ## Core Distinction There are two different things an A2A caller can be "stale" about, and they fail in opposite directions: 1. **Stale identity** — the card's `url`, `preferredTransport`, or signing key changed. This fails *loudly*: connection refused, TLS name mismatch, or a signature that won't verify. The caller errors out and the operator sees it. 2. **Stale capability surface** — the card's `skills[]`, `defaultInputModes`/`defaultOutputModes`, or `securitySchemes` changed while `url` and identity stayed constant. This fails *silently and late*: the envelope is accepted (HTTP 200, task enters `submitted`), and only after the remote agent begins execution does it discover it cannot satisfy the requested `skillId` or cannot produce the declared output mode. The task then parks in `working` until a timeout the caller never configured, or is rejected with an error the caller's state machine does not map. The non-obvious boundary is this: **A2A task acceptance is not capability validation.** The remote agent's `tasks/send` handler is required to accept the envelope and create a task resource; it is *not* required to validate the requested skill against its current card before returning. A caller that treats `200 + task.id` as proof that the skill exists has conflated transport success with capability agreement. The deadlock is the gap between those two facts. ## What Was Observed A caller agent (Org A) resolved Org B's card at T0 and cached it for 6 hours per an internal TTL. The card at T0 advertised: ``` skills: [ { id: "invoice.reconcile", inputModes: ["application/json"] } ] securitySchemes: { "oauth2": {...} } ``` At T2 (90 min later) Org B shipped a breaking change: `invoice.reconcile` was renamed to `ledger.reconcile` and its `inputModes` narrowed to `["application/json", "application/x-ndjson"]` with a new required `schemaVersion` field in the payload. The card `url`, signing key, and `preferredTransport` were unchanged, so Org A's identity-level health checks stayed green. At T3 Org A dispatched a delegation envelope: ``` { "task": { "id": "a-7f3", "skillId": "invoice.reconcile", "message": { "role": "user", "parts": [ { "type":"data", "data": {...} } ] } } } ``` The remote returned `200` with a new `task.id = b-2c9` and state `submitted`. Org A's state machine moved to `working` and began polling `tasks/get` on an interval. What actually happened on the remote: the skill dispatcher could not route `invoice.reconcile` to any handler. Because the handler was absent rather than erroring, the task remained in `submitted` → transitioned to `working` by the generic worker loop → and then blocked waiting on a handler result that would never be produced. The remote had no timeout on skill dispatch; the task sat in `working` indefinitely. Org A polled for 40 minutes, its own delegation timeout was unset (defaulted to "wait"), and the calling agent's turn never completed. The upstream orchestrator, which had a 30-minute wall clock, killed the *caller* — leaving the remote task `b-2c9` orphaned in `working`. Three concurrent symptoms compounded: - **Acceptance without routing.** The remote's `200` was truthful about task creation and false about skill availability. The A2A spec permits this; capability is advisory metadata, not a contract enforced at the transport boundary. - **No terminal state.** Neither side transitioned the task to `failed`. The remote had no dispatch timeout; the caller had no delegation timeout. Two missing timeouts produce a deadlock that looks like slowness. - **Orphaned remote state.** When the caller was killed, nothing sent `tasks/cancel`. The remote task's lifecycle outlived its initiator, and `tasks/get` on it from any later caller returns a `working` task that will never move. ## Condition of Validity The deadlock is bounded only when *all* of the following hold. If any is false, the failure is reachable: 1. **Card TTL < remote breaking-change cadence.** A cached card is only safe if its `skills[]` and mode declarations are guaranteed unchanged for the TTL window. There is no field in A2A v1.0 that promises this; `version` on the card is informational and not required to bump on skill changes. Caching must therefore be paired with revalidation, not assumed safe. 2. **Caller validates `skillId` against the card immediately before dispatch, not at cache time.** Validation at cache time validates a snapshot; the envelope is built later against live state. 3. **Caller sets an explicit delegation timeout shorter than its own turn budget,** and on expiry sends `tasks/cancel` before abandoning the task id. 4. **Remote sets a dispatch timeout** such that an unroutable skill transitions the task to `failed` with a machine-readable reason rather than parking in `working`. The invariant that must hold: **a task in `working` must have a live handler bound to it, or a timeout that will fire.** A2A does not enforce this; the caller must assume it does not and defend. ## Decision Boundary The caller must decide, per delegation, between two strategies: - **Trust-the-card (fast path):** dispatch against the cached card, accept `200` as sufficient, poll without a local timeout. Valid *only* when caller and callee share an org or a release train that bumps `version` atomically with skill changes, and the caller's turn budget exceeds any plausible remote execution time. Outside that, it is a deadlock generator. - **Revalidate-then-dispatch (safe path):** before building the envelope, re-fetch `/.well-known/agent-card.json` (or a conditional GET against the cached ETag), confirm the requested `skillId` and `inputModes` are present in the *live* card, attach a `deadline` to the task envelope, and register a local timer that fires `tasks/cancel` on expiry. Cost is one extra round trip per delegation; benefit is that capability mismatch is caught before a task resource is created. The boundary is crossed the moment the caller's cache TTL exceeds the callee's skill-change cadence *or* the caller has no cancel-on-timeout path. Below that line, trust-the-card is correct and cheap. Above it, every delegation is a potential orphan. ## Operational Effect The practical consequences, in order of severity: - **Orphaned remote tasks accumulate.** Each deadlocked delegation leaves a `working` task on the remote that no one will cancel. Over days these consume remote concurrency slots and, in agents with per-tenant task quotas, eventually cause *new* delegations to be rejected for quota — a failure that appears unrelated to the original bug. - **Caller turn budgets are silently consumed.** The caller's orchestrator sees a hung turn, not a failed delegation. Retry logic that keys on task `failed` never triggers; retry logic that keys on turn timeout retries the *whole* turn, re-dispatching the same stale `skillId` and compounding the orphan count. - **Capability drift becomes invisible.** Because the remote accepts and the caller waits, no error surfaces in either org's logs at the point of mismatch. The first observable signal is the quota rejection or the turn-budget kill, both far downstream of the actual cause. - **Verification replay diverges.** If an auditor agent later replays the delegation to check the outcome, it resolves the *current* card, sees `ledger.reconcile`, and cannot reconcile it with the recorded `invoice.reconcile` envelope — the audit trail shows a skill that no longer exists, with no record of when it was retired. The guardrail is a single rule: **never dispatch a delegation against a card you have not validated in the same turn, and never create a task you are not prepared to cancel.** The code below encodes that as an enforced pre-dispatch check and a cancel-on-deadline wrapper. ```python import time from dataclasses import dataclass from typing import Optional class StaleAgentCardError(RuntimeError): """Raised when a delegation envelope targets a skill/mode absent from the live card.""" class DelegationDeadlineError(RuntimeError): """Raised when a delegated task fails to reach a terminal state before its deadline.""" @dataclass class AgentCard: url: str version: str skills: dict # skillId -> {"inputModes": [...], "outputModes": [...]} fetched_at: float def validate_against_live_card(card: AgentCard, skill_id: str, input_mode: str, max_age_s: float = 300.0) -> None: """Reject dispatch if the skill/mode is missing or the card snapshot is too old.""" age = time.time() - card.fetched_at if age > max_age_s: raise StaleAgentCardError( f"card for {card.url} is {age:.0f}s old (max {max_age_s:.0f}s); " f"re-fetch before dispatch" ) skill = card.skills.get(skill_id) if skill is None: raise StaleAgentCardError( f"skillId {skill_id!r} not present in live card for {card.url} " f"(have: {sorted(card.skills)})" ) if input_mode not in skill.get("inputModes", []): raise StaleAgentCardError( f"inputMode {input_mode!r} not accepted by {skill_id!r} " f"(accepts: {skill['inputModes']})" ) def delegate_with_deadline(transport, card: AgentCard, skill_id: str, input_mode: str, payload: dict, deadline_s: float = 600.0) -> dict: """Dispatch a task, enforce a local deadline, cancel on expiry, never orphan.""" validate_against_live_card(card, skill_id, input_mode) task = transport.send(card.url, { "skillId": skill_id, "message": {"role": "user", "parts": [{"type": "data", "data": payload}]}, "deadline": time.time() + deadline_s, }) task_id = task["id"] started = time.time() while True: state = transport.get(card.url, task_id)["status"]["state"] if state in ("completed", "failed", "canceled"): return {"task_id": task_id, "state": state} if time.time() - started > deadline_s: transport.cancel(card.url, task_id) # never leave an orphan raise DelegationDeadlineError( f"task {task_id} on {card.url} stuck in {state!r} " f"past {deadline_s:.0f}s deadline; cancel sent" ) time.sleep(5.0) ```