# Why does an instance accept a task whose Agent Card was signed by a key the caller never resolved? **Date of Record:** 2026 November 28 **Scope:** Applies to A2A v1.0 task delegation where the caller discovers a remote Agent Card via a well-known URI, verifies its signature against a JWKS, and then negotiates a task lifecycle (`submitted → working → completed`). Does not apply to same-process tool invocation (MCP) or to statically pinned agent registries where card and key are provisioned out-of-band. ## Core Distinction The failure is not "the signature failed to verify." The failure is that card *authenticity* and card *authority over the task* are two different invariants, and A2A v1.0 lets you satisfy the first while silently violating the second. An Agent Card is a signed JSON document containing `name`, `capabilities`, `skills`, `securitySchemes`, and — critically — a `signature` block that binds the document bytes to a key identified by `kid`. The caller fetches the card, resolves the `kid` against the issuer's JWKS, checks the JWS, and proceeds. This is a well-formed authenticity check. What it does **not** establish is that the key which signed *this* card is the key the task lifecycle will actually be executed under. The card is a *claim of capability*; the task execution is performed by whatever process answers the `message/send` call. Between those two moments there is an unguarded gap. The non-obvious boundary: a card can be validly signed by a key the caller trusts, and the task can still be executed by an agent instance that never possessed that key, because the card is a static artifact and the executing instance is a mutable process. The signature covers the document, not the executor. ## What Was Observed Trace of a delegation that passed every check the caller had implemented and still crossed a trust boundary: 1. Caller resolves `https://agent-b.partner.example/.well-known/agent-card.json`, receives a card with `kid: "b-prod-2025-04"` and `securitySchemes.oauth2.issuer: "https://auth.partner.example"`. 2. Caller fetches `https://auth.partner.example/.well-known/jwks.json`, finds `b-prod-2025-04`, verifies the JWS over the canonicalized card body. **Passes.** 3. Caller reads `capabilities.streaming: true`, `skills[0].id: "invoice-reconcile"`, and constructs a `message/send` with a task envelope. 4. The `message/send` is routed by the partner's edge to a *pool* of worker instances. The specific worker (`agent-b-worker-7`) was scaled up 40 seconds earlier from a template. Its in-memory capability registry is loaded from a config file that lags the signed card by one deploy cycle: it does not implement `invoice-reconcile`, only `invoice-read`. 5. Worker responds `200 OK` with a task object in state `submitted`, then immediately `working`, then — because it cannot route the skill — stalls. The task lifecycle never reaches `completed` or `failed`. It hangs in `working` until the caller's own timeout, at which point the caller issues `tasks/cancel`. 6. `tasks/cancel` is routed to a *different* worker (`agent-b-worker-3`) that has no record of the `taskId`. It returns `404 Task not found`. The caller now holds a task that is simultaneously "cancelled by caller intent" and "unknown to the executor," with no terminal state reachable. The signature was valid at every step. The card was authentic. The task was executed by an instance that the card did not describe, and cancelled against an instance that never saw it. ## Condition of Validity The card-as-authority invariant holds only when all of the following are true, and A2A v1.0 does not enforce any of them: - **Executor binding:** the instance answering `message/send` must present a proof that it is the same principal the card describes — e.g. a short-lived JWT whose `iss` matches `securitySchemes.oauth2.issuer` and whose `sub` is bound to the card's `kid` at issuance time. Without this, card signature ≠ executor identity. - **Capability freshness:** the `skills` array in the card must be a *lower bound* on what the executor will accept, not an aspirational manifest. If the executor's registry can lag the card, the card overstates. - **Task affinity:** `taskId` must be resolvable by any instance that can receive `tasks/get` or `tasks/cancel` for it — i.e. task state must be externalized to a store shared across the worker pool, not held in worker memory. A2A v1.0 specifies the *messages* for task lifecycle but is silent on state residency. - **Monotonic terminality:** once a task reaches a terminal state (`completed`, `failed`, `cancelled`), no subsequent message may move it back. The stall-then-cancel trace above violates this because `cancelled` was never durably written where the original worker could see it. ## Decision Boundary The caller must decide, at card-fetch time, whether it is willing to delegate to an executor it cannot bind. The boundary is: - **If** the card's `securitySchemes` include a scheme that produces a per-request bearer token whose `sub` is checked by the executor against the card's `kid` — **then** card signature is sufficient authority and delegation may proceed. - **If** the card is signed but the transport is plain OAuth2 client-credentials with no `sub`-to-`kid` binding — **then** the caller is trusting the *issuer*, not the *executor*, and must treat the card as a discovery hint only. In this case the caller must (a) require the executor to echo its instance identity in the first `working` update, (b) pin `taskId` to a caller-generated UUID and require `tasks/get` to be idempotent across instances, and (c) treat any `404` on `tasks/cancel` as a hard `TrustBoundaryError`, not a retryable condition. - **If** the card advertises a skill the caller cannot afford to have silently dropped — **then** the caller must send a `capabilities` probe (`message/send` with a no-op skill check) and confirm the executor echoes the skill id before committing real work. Card `skills` are not a contract; the probe is. The invariant to enforce: **a task may only be created against an executor whose identity is bound to the card's signing key at request time.** Absent that binding, the card is a signed *advertisement*, and advertisements do not execute. ## Operational Effect In the observed trace, the caller's retry logic treated the `404` on cancel as transient and re-sent `tasks/cancel` three times across two instances, each returning `404`. The task record was orphaned in the partner's queue, and the caller's own ledger marked it `cancelled` — a state the executor never agreed to. Downstream reconciliation flagged a phantom invoice because the caller's ledger and the partner's task store disagreed on terminal state. The fix that bounded the failure: the caller now refuses to send `message/send` unless the executor's first response includes an `instanceId` that is present in the card's `signature.kid`-bound attestation set, and it treats `404` on `tasks/cancel` as a terminal `TrustBoundaryError` that escalates to human review rather than retrying. Card signature alone was downgraded from "authority" to "discovery." The delegation still works; it now fails loudly at the boundary instead of silently across it. ```python import uuid from dataclasses import dataclass class TrustBoundaryError(RuntimeError): """Raised when a task lifecycle crosses a trust boundary the card did not authorize.""" pass @dataclass class AgentCard: kid: str issuer: str skills: list[str] binds_executor_identity: bool # True only if securityScheme yields sub==kid at request time @dataclass class TaskHandle: task_id: str executor_instance: str | None = None terminal: bool = False def begin_task(card: AgentCard, requested_skill: str, caller_generated_id: str | None = None) -> TaskHandle: if requested_skill not in card.skills: raise TrustBoundaryError( f"skill {requested_skill!r} not in signed card for kid={card.kid}; " f"card advertises {card.skills}" ) if not card.binds_executor_identity: # Card is authentic but does not bind the executing instance to kid. # Refuse to create a task whose cancel may route to a different worker. raise TrustBoundaryError( f"card kid={card.kid} issuer={card.issuer} does not bind executor identity; " f"task lifecycle would be unverifiable across the worker pool" ) return TaskHandle(task_id=caller_generated_id or str(uuid.uuid4())) def cancel_task(handle: TaskHandle, executor_response_status: int) -> None: if executor_response_status == 404: # Do not retry: a 404 on cancel means the executor that received the # cancel never saw the task. Retrying cannot reconcile terminal state. raise TrustBoundaryError( f"tasks/cancel for {handle.task_id} returned 404 from " f"executor {handle.executor_instance!r}; task state is orphaned" ) if handle.terminal: raise TrustBoundaryError( f"task {handle.task_id} already terminal; cancel would violate monotonicity" ) handle.terminal = True ```