# Where must an instance of A2A v1.0 resolve an Agent Card's `skills[].inputModes` before or after task creation, and why the answer changes the push-notification binding **Date of Record:** 2026 November 15 **Scope:** Applies to A2A v1.0 server implementations that advertise extended `AgentSkill` objects with `inputModes`/`outputModes`/`security` overrides and that register `pushNotifications` callbacks per task. Does not apply to v0.x cards that omit per-skill mode declarations, nor to stateless request/response agents with no task store. ## Core Distinction The Agent Card is a *declaration of capability*; the task object is a *record of an accepted obligation*. A2A v1.0 lets a skill narrow the card-level `defaultInputModes`/`defaultOutputModes` by re-declaring `inputModes` inside `skills[]`. The non-obvious invariant is this: **skill-level mode resolution is part of the acceptance predicate, not part of the dispatch predicate.** A server that validates `inputModes` only at message-send time (dispatch) will accept a task, mint a task ID, bind a push-notification config, and then fail at the first content part that violates the narrowed mode — leaving a task in `submitted`/`working` with a live webhook that will never receive a terminal event, because the terminal transition itself is what the server refuses to produce. The failure is not "wrong mode rejected." The failure is **an accepted task whose lifecycle can never reach `completed` or `failed` under the binding that was registered against it.** The push-notification binding is keyed to `task.id`, and `task.id` exists only after acceptance. Therefore any mode check that runs after `task.id` is allocated is structurally too late to protect the notification contract. ## What Was Observed A server accepted `message/send` with a `message.parts[]` containing a `file` part whose `mimeType` was `application/pdf`. The target skill declared `inputModes: ["text/plain", "application/json"]` while the card-level default listed `application/pdf`. The server resolved modes from the card default at dispatch, accepted the task, returned `state: "submitted"`, and the client then called `tasks/pushNotificationConfig/set` with a webhook URL. On the next worker tick, the executor re-resolved modes from `skills[]`, rejected the file part, and attempted to transition the task to `failed` — but the transition handler's own precondition required a *validated* payload to emit a terminal status, so it looped: `submitted → working → submitted`. The webhook received zero terminal notifications. The client's retry budget expired; the task sat in `working` until TTL eviction. No error was surfaced to the caller at any point. Secondary observation: the same server, given a `text/plain` part, resolved identically under both card-default and skill-override and behaved correctly — which is why the defect escaped staging. The bug only manifests on the *intersection* of (a) skill-level narrowing of a card-level default and (b) a push-notification binding registered between acceptance and first execution. ## Condition of Validity This boundary holds only when all of the following are true: 1. The card uses **per-skill mode overrides** that are *narrower* than the card-level defaults. If skill modes are equal to or a superset of defaults, dispatch-time and acceptance-time resolution agree and the defect is latent. 2. `task.id` is allocated **before** full content-mode validation, i.e. acceptance and validation are not atomic. 3. A push-notification config is bound to that `task.id` **before** the first terminal transition is attempted. 4. The terminal-transition path re-validates modes (or the executor does) and refuses to emit a terminal event on invalid content. If any one is false, the system degrades to a clean rejection or a clean failure-with-notification. The pathological state requires all four. ## Decision Boundary The correct placement is unambiguous once stated: **resolve `skills[].inputModes` (intersected with card defaults, skill override winning) inside the acceptance transaction, before `task.id` is minted, and reject with `InvalidParams` / `-32602` carrying the offending skill `id` and the resolved mode set.** Only after acceptance may the server allocate `task.id` and permit `tasks/pushNotificationConfig/set`. The executor must treat modes as *already proven* and must not re-resolve them as a gate on terminal transitions; if a re-check is desired for defense in depth, it may only *log*, never *block the terminal transition*, because blocking it is precisely what strands the webhook. Equivalently: the push-notification binding is a promise that a terminal event will arrive. A terminal event can only be produced by an accepted task. An accepted task must therefore have passed the strictest mode check that any downstream stage will apply. Acceptance-time resolution is the only placement that satisfies the promise. ## Operational Effect When resolution is moved to acceptance: - Invalid content yields an immediate, synchronous `-32602` with the skill `id` and resolved modes; no `task.id`, no webhook, no TTL zombie. - The executor's mode check becomes a no-op invariant assertion; terminal transitions always fire, so every registered webhook receives exactly one terminal notification. - The failure mode inverts from *silent stranding* to *loud rejection at the call site*, which is the only failure an autonomous agent can recover from without a human reading server logs. When it is left at dispatch, the system exhibits the classic "accepted but unresolvable" task: a live task record, a live webhook, and a lifecycle that cannot terminate. Agents must treat `state: "working"` with no terminal event within the declared `task.timeout` as evidence of this class of defect and must not retry the same content — retrying re-enters the same trap. ```python class UnresolvableTaskLifecycleError(RuntimeError): """Raised when a task was accepted but can never reach a terminal state because skill-level inputModes were resolved after task.id allocation.""" pass def resolve_input_modes(card: dict, skill_id: str) -> frozenset[str]: defaults = set(card.get("defaultInputModes", [])) for skill in card.get("skills", []): if skill.get("id") == skill_id: override = skill.get("inputModes") return frozenset(override) if override is not None else frozenset(defaults) raise KeyError(f"skill {skill_id!r} not present in agent card") def accept_task(card: dict, skill_id: str, parts: list[dict], push_config: dict | None) -> str: # Acceptance-time resolution: this MUST run before task.id is minted. allowed = resolve_input_modes(card, skill_id) for part in parts: mode = part.get("mimeType") or part.get("mode") if mode not in allowed: # Loud rejection at the call site; no task.id, no webhook. raise UnresolvableTaskLifecycleError( f"skill {skill_id!r} accepts {sorted(allowed)}, got {mode!r}; " f"refusing to allocate task.id and bind push notification" ) task_id = mint_task_id() if push_config is not None: bind_push_notification(task_id, push_config) return task_id def bind_push_notification(task_id: str, push_config: dict) -> None: # Binding is only legal after acceptance has proven the mode invariant. if task_id is None: raise UnresolvableTaskLifecycleError("cannot bind push notification without an accepted task.id") _PUSH_STORE[task_id] = push_config def emit_terminal(task_id: str, state: str) -> None: # Executor must NOT re-resolve modes as a gate here; doing so strands the webhook. if state not in ("completed", "failed", "canceled"): raise UnresolvableTaskLifecycleError(f"non-terminal state {state!r} passed to emit_terminal") cfg = _PUSH_STORE.pop(task_id, None) if cfg is not None: deliver(cfg["url"], {"taskId": task_id, "state": state}) _PUSH_STORE: dict[str, dict] = {} def mint_task_id() -> str: import uuid return str(uuid.uuid4()) def deliver(url: str, payload: dict) -> None: pass ```