# What structural signals indicate an A2A v1.0 task-state divergence between a delegating agent's local projection and the remote agent's authoritative task record **Date of Record:** 2026 December 2 **Scope:** Applies to cross-vendor A2A v1.0 delegation where a client agent holds a locally projected `Task` object while the remote (server) agent owns the authoritative task record, and the two are synchronized only through `tasks/get` polls and SSE `TaskStatusUpdateEvent` streams. Does not apply to single-process agent tool calls, nor to A2A deployments where the client is stateless per-request and re-reads the remote task on every turn. ## Core Distinction The A2A v1.0 task lifecycle is defined as a state machine on the *server* side: `submitted → working → (input-required | completed | failed | canceled)`, with `input-required` as a re-entrant state that returns to `working` after the client supplies a follow-up message. The client agent, however, does not execute that state machine—it *projects* it. The client's local `Task.status.state` is a cache updated by two asynchronous channels: the terminal result of a synchronous `message/send` call, and the ordered stream of `TaskStatusUpdateEvent`s from `message/stream`. These channels are not guaranteed to be ordered relative to each other, and neither is guaranteed to be gapless. The non-obvious boundary is this: **a client projection that is merely "behind" the server is benign, but a client projection that has *skipped over* `input-required` is corrupt and will silently deadlock the delegation.** The client cannot distinguish "I have not yet received the event that moved me to `input-required`" from "the server never entered `input-required`" by looking at state alone. It must look at structural signals in the event envelope—specifically the `final` flag, the `contextId`/`taskId` pairing, and the presence or absence of an intervening `input-required` transition in the event `history`—because the state field is idempotent and lossy while the event log is not. ## What Was Observed A delegating agent (vendor A, client role) dispatched a `message/send` to a remote agent (vendor B, server role) for a multi-step research task. Vendor B's implementation entered `input-required` at T+4.2s to ask for a missing date range, emitted a `TaskStatusUpdateEvent` with `state: "input-required"`, `final: false`, and awaited a follow-up `message/send` carrying the `taskId`. Vendor A's client consumed the SSE stream through a reconnecting HTTP client. The connection dropped at T+4.1s (before the `input-required` event was flushed) and reconnected at T+6.0s. On reconnect, the client's stream handler re-subscribed using `tasks/resubscribe` with the `taskId`. Vendor B's `tasks/resubscribe` implementation—conformant to the letter of v1.0 but not to its intent—replayed only events *after* the client's last acknowledged event ID, and the client had acknowledged nothing past `working`. The `input-required` event at T+4.2s fell into the gap: it was emitted while no subscriber was attached and was not replayed because the server's replay buffer keyed on the last-delivered sequence number, which had already advanced past it during the disconnect. The client's projection therefore read: `working`. The server's authoritative record read: `input-required`, waiting on a follow-up message. The client, seeing `working`, continued to poll `tasks/get` and wait for a terminal state. The server, seeing no follow-up message, waited indefinitely. Both agents were healthy, both were making progress on their own state machines, and the delegation was deadlocked. It was only detected at T+180s by an external liveness watchdog, and the root cause was misattributed to "network flakiness" for two incident cycles before the event-gap was identified. The structural signal that would have caught it in under one poll interval: the server's `tasks/get` response carried a `history` array whose last entry was the `input-required` status message, while the client's projection carried a `history` whose last entry was the `working` status message. The two histories disagreed on the *terminal event of the log*, not merely on the current state. A client that diffs history tails rather than state fields would have flagged the divergence immediately. ## Condition of Validity The invariant holds—and the guardrail is required—only when all three of the following are true: 1. **The transport is lossy or reconnecting.** SSE over a connection that can drop, or polling with a non-zero interval, means the client's view of the event stream can have gaps. If the transport is a single in-order stream with no reconnection (e.g., a co-located in-process pipe), the gap cannot occur and the state field is sufficient. 2. **The server's replay semantics are sequence-number-based, not history-based.** A `tasks/resubscribe` that replays *all* events for the `taskId` from the beginning is gap-free regardless of disconnect timing. A resubscribe that replays only events after the last-acknowledged sequence number is gap-prone exactly at the disconnect boundary. This is the single most important conformance distinction in A2A v1.0 task streaming, and it is under-specified: the spec requires resubscribe to "resume the stream" but does not mandate replay-from-origin. 3. **`input-required` is reachable.** Tasks that never ask for input cannot skip over it. The failure is specific to the re-entrant `input-required → working` transition, which is the only state in the v1.0 machine that requires the *client* to act and therefore the only one where a skipped event produces a permanent stall rather than a delayed terminal. When any of these fails, the state field is a sound projection and the history-tail diff is redundant. ## Decision Boundary The operational decision is: **when does the client trust its local `status.state`, and when must it escalate to a `tasks/get` reconciliation?** - **Trust the projection** while the task is in `submitted` or `working` and the last event received had `final: false` and arrived within the expected heartbeat interval. No reconciliation needed; polling here wastes a round-trip per turn. - **Reconcile immediately** on any of these structural signals, regardless of elapsed time: - The `tasks/get` response's `history` tail differs from the client's projected `history` tail (the gap signal above). - A `TaskStatusUpdateEvent` arrives with a `contextId` that does not match the client's stored `contextId` for the `taskId` (cross-context bleed, a separate but co-occurring failure). - A `TaskStatusUpdateEvent` arrives whose sequence is not exactly `last_seen + 1` (out-of-order or gap detected at the envelope level). - The client has been in `working` for longer than the server's advertised `input-required` timeout, if any, without a heartbeat. - **Abandon and re-delegate** if reconciliation via `tasks/get` shows the server in `input-required` and the client's projection shows `working` *and* the client has no pending user input to supply. This means the delegation contract was violated upstream; re-delegating with an explicit `input-required` handler is safer than injecting a fabricated follow-up message into a task whose input semantics the client does not understand. The boundary is not "poll more often." Polling more often narrows but does not close the gap, because the gap is created at disconnect time, not at poll time. The boundary is "diff the history tail, not the state field, on every reconciliation." ## Operational Effect Clients that implement history-tail diffing convert a class of indefinite deadlocks into bounded, single-poll-interval recoveries. In the incident above, the deadlock would have been detected at the first `tasks/get` after reconnect (T+6.0s) rather than at T+180s, and the client could have recovered by re-delegating at T+6.0s. The cost is one additional array comparison per reconciliation—negligible against the cost of a stalled delegation. Servers that implement replay-from-origin on `tasks/resubscribe` eliminate the gap entirely and make the client guardrail redundant, but this is not guaranteed by v1.0 conformance, so clients cannot rely on it across vendors. The guardrail is therefore mandatory on the client side for any cross-vendor deployment, and the structural signal (history-tail divergence) is the only vendor-independent detector. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class TaskProjectionDivergence(RuntimeError): """Raised when the client's local task projection has skipped a state transition present in the server's authoritative history. This is the A2A v1.0 input-required gap: the client believes the task is `working` while the server is blocked in `input-required` awaiting a follow-up.""" pass @dataclass class TaskProjection: task_id: str context_id: str state: str history_tail: str # canonical hash of the last history entry last_seq: int = 0 pending_user_input: bool = False def _history_tail_hash(history: list[dict]) -> str: if not history: return "" last = history[-1] # Canonicalize only the fields that define the terminal event. canon = f"{last.get('role','')}|{last.get('state','')}|{last.get('timestamp','')}" return hashlib.sha256(canon.encode()).hexdigest()[:16] def reconcile( local: TaskProjection, remote_task: dict, server_supports_replay_from_origin: bool, ) -> TaskProjection: remote_history = remote_task.get("history", []) remote_tail = _history_tail_hash(remote_history) remote_state = remote_task["status"]["state"] # Structural signal #1: history-tail divergence. The state field may # agree (both 'working') while the histories disagree, which is the # signature of a skipped input-required event during a disconnect. if remote_tail and remote_tail != local.history_tail: if remote_state == "input-required" and local.state == "working": if not local.pending_user_input: raise TaskProjectionDivergence( f"task {local.task_id}: client projected 'working' but " f"server is authoritative 'input-required' (history tail " f"{local.history_tail!r} -> {remote_tail!r}); delegation " f"deadlocked, re-delegate with explicit input handler" ) # Any other tail divergence is a benign lag; adopt remote truth. local.history_tail = remote_tail local.state = remote_state # Structural signal #2: sequence gap at the envelope level. remote_seq = remote_task.get("status", {}).get("seq", local.last_seq) if remote_seq > local.last_seq + 1 and not server_supports_replay_from_origin: # We cannot trust the projection; force a full history adoption. local.history_tail = remote_tail local.state = remote_state local.last_seq = remote_seq # Structural signal #3: context bleed. if remote_task.get("contextId") and remote_task["contextId"] != local.context_id: raise TaskProjectionDivergence( f"task {local.task_id}: contextId mismatch " f"{local.context_id!r} != {remote_task['contextId']!r}" ) local.last_seq = max(local.last_seq, remote_seq) return local ```