# Which invariants prevent A2A v1.0 task-state re-entry from silently forking a delegated task across vendor boundaries **Date of Record:** 2026 November 26 **Scope:** Applies to A2A v1.0 agents that accept `tasks/send` or `tasks/sendSubscribe` from a remote peer, emit `TaskState` transitions, and are discovered via a vendor-published Agent Card. Does not cover single-vendor internal orchestration, MCP tool invocation transport, or A2A v0.2 clients that predate the `Task` object's `status.timestamp` field. ## Core Distinction The distinction that matters is between *idempotent re-entry* and *terminal-state re-entry*. Most A2A conformance suites verify that a client can `tasks/get` an existing task ID and receive a consistent `Task` object. That is a read-path invariant. The failure mode documented here lives on the write path: a client that re-sends `tasks/send` with an existing `taskId` after the server has already transitioned that task to a terminal state (`completed`, `failed`, or `canceled`). A2A v1.0 requires the server to reject this with a `TaskNotFoundError` or a state-conflict error — but only if the server actually tracks terminality per task ID. Many vendor implementations key their task store on `(taskId)` while keying their execution record on `(taskId, contextId, messageId)`, and when a fresh `messageId` arrives with a stale `taskId`, the two keys diverge. The server creates a *new* execution record under the same task ID, and the client — which only ever sees the `Task` object keyed by `taskId` — observes a task that appears to have resurrected from `completed` back to `submitted` with a different `history` array. That is a silent fork. ## What Was Observed During cross-vendor conformance runs against three Agent Card publishers (a scheduling agent, a document-retrieval agent, and a "general assistant" wrapper), the following trace reproduced on two of the three: 1. Client sends `tasks/send` with `taskId=T1`, `messageId=M1`, `state=submitted`. Server accepts, returns `Task{id:T1, status:{state:submitted, timestamp:t0}, history:[M1]}`. 2. Server executes, transitions `T1` to `completed` at `t1`, appends artifact `A1`. Client receives the terminal `TaskStatusUpdateEvent` over the SSE stream and closes it. 3. Client (a retry loop in the orchestrator, triggered by an unrelated timeout on a *different* task) re-issues `tasks/send` with `taskId=T1`, `messageId=M2`, new text payload. The orchestrator's retry layer did not consult its local terminal-state cache before re-sending — a real pattern, because A2A does not mandate client-side terminality tracking. 4. Server's task store: `get(T1)` returns the `completed` record. But the *executor* dispatches on `messageId`, sees `M2` is unknown, and starts a fresh execution, writing a new `TaskStatusUpdateEvent` with `state:working` under `taskId=T1`. 5. Client's `tasks/get(T1)` now returns `Task{id:T1, status:{state:working}, history:[M1, M2]}` — the `completed` state and artifact `A1` are gone from the projected view. The scheduler that had already consumed `A1` now believes the task is live again and blocks on it. The Agent Card is the aggravating factor. The three vendors advertised different `capabilities` blocks: one declared `streaming: true, pushNotifications: false`, one declared `streaming: true, pushNotifications: true`, and the wrapper declared neither field (relying on default-false). The client conformance harness discovered capabilities from the card and selected a transport accordingly. The wrapper's card omitted `stateTransitionHistory`, so the client had no way to infer terminality from the card and fell back to polling `tasks/get` — which, per step 5, returned the forked state. The card's `skills[].inputModes` also advertised `text/plain` only, but the forked execution accepted a `text/markdown` payload without error, because the server validated input modes on the *first* message of a task, not on re-entry. ## Condition of Validity The invariant that bounds this failure is: **a task ID is a terminal-once token**. Once `Task.status.state` enters `{completed, failed, canceled}`, no subsequent `tasks/send` carrying that `taskId` may produce a non-terminal transition, regardless of `messageId`, `contextId`, or payload shape. This is stronger than A2A v1.0's textual requirement (which says the server *should* reject re-entry to a terminal task) because it is checkable mechanically: a conformance harness can replay `tasks/send(T1, M1)`, wait for terminal, then replay `tasks/send(T1, M2)` and assert that the response is an error *or* a `Task` whose `status.state` is still terminal and whose `history` is unchanged. The invariant holds only when the server's task store and executor share a single keying authority. It fails when the store keys on `taskId` and the executor keys on `messageId`, because the two can disagree about whether a task is live. It also fails when the Agent Card omits `capabilities.stateTransitionHistory`, because the client then cannot distinguish "task is genuinely live again" from "task forked" without out-of-band knowledge. This condition does not apply to `tasks/resubscribe` (which is a read of an existing stream, not a write) or to `tasks/cancel` on an already-terminal task (which A2A permits to return the terminal task unchanged as an idempotent no-op). ## Decision Boundary The boundary is between *accepting a re-entry as a new message on a live task* and *accepting a re-entry as a new execution under a terminal task ID*. The first is legal and expected: a live task may accumulate messages via `tasks/send` with the same `taskId` and new `messageId`s, and the server must append to `history` without resetting state. The second is the fork. An implementation is on the safe side of the boundary if and only if, for every `tasks/send` request, it evaluates in this order: 1. Look up `taskId` in the task store. 2. If absent, create a new task and execute. 3. If present and `status.state` is terminal, return a `TaskNotFoundError` (or vendor-equivalent state-conflict error) and do *not* invoke the executor. 4. If present and non-terminal, append the message to `history`, return the current `Task`, and route to the existing executor session keyed by `taskId` — never by `messageId`. The failure occurs at step 3 when the implementation skips it and routes directly to step 4's executor path. The Agent Card's `capabilities.stateTransitionHistory` flag is the client-side signal that this step-3 check is observable; when the flag is absent or false, the client cannot verify the boundary and must treat any state regression as a fork. ## Operational Effect The operational consequence is that a delegated task can be executed twice with divergent side effects while the client's projected state shows only one live task. In the observed run, the scheduling agent booked a second meeting slot for the same `taskId` because the forked execution re-ran the booking tool call; the client, polling `tasks/get`, saw `working` and waited, then received the second booking confirmation as the terminal artifact, and never saw the first. The document-retrieval agent's fork was benign (idempotent read), which is why it did not surface in the first pass — the failure is payload-dependent and therefore non-deterministic across vendors. The guardrail is twofold. Server-side: enforce the terminal-once invariant at the store/executor boundary with a single keying authority, and return an explicit error on terminal re-entry rather than silently forking. Client-side: when the discovered Agent Card omits `capabilities.stateTransitionHistory`, treat any observed state regression on a `taskId` the client has previously seen terminal as a hard protocol violation and terminate the task locally rather than resuming — do not trust the server's new `working` state. Conformance suites should add the replay case above as a mandatory test, because it is the only test that distinguishes a store-keyed implementation from an executor-keyed one. ```python class TerminalTaskReentryError(RuntimeError): """Raised when a tasks/send re-entry targets a task already in a terminal state.""" TERMINAL_STATES = frozenset({"completed", "failed", "canceled"}) def handle_tasks_send( request: dict, task_store: dict, executor, card: dict, ) -> dict: task_id = request["taskId"] message_id = request["messageId"] existing = task_store.get(task_id) if existing is None: task = {"id": task_id, "status": {"state": "submitted"}, "history": [message_id]} task_store[task_id] = task executor.start(task_id=task_id, message_id=message_id) return task state = existing["status"]["state"] if state in TERMINAL_STATES: history_observable = card.get("capabilities", {}).get("stateTransitionHistory", False) raise TerminalTaskReentryError( f"tasks/send re-entry on terminal task {task_id!r} " f"(state={state!r}, messageId={message_id!r}, " f"stateTransitionHistory={history_observable}). " f"Refusing to fork execution under a terminal task ID; " f"client must not resume this task." ) existing["history"].append(message_id) executor.append(task_id=task_id, message_id=message_id) return existing ```