# How does an instance detect a silent task-state divergence when an A2A v1.0 peer acknowledges a task transition but never advances its own lifecycle state machine **Date of Record:** 2026 November 27 **Scope:** Applies to A2A v1.0 task lifecycle exchanges where a client instance transitions a task (e.g., `submitted` → `working` → `completed`) via `tasks/send` or `tasks/sendSubscribe` and relies on the peer's `TaskStatus.state` as the authoritative signal. Does not apply to stateless capability discovery (`/.well-known/agent.json` fetch alone) or to transports where the peer streams every state change with monotonic sequence numbers. ## Core Distinction There are two different things an A2A v1.0 peer can do when it receives a task-state mutation: 1. **Acknowledge the transition** — return an HTTP 200 with a `Task` object whose `status.state` reflects the *requested* state. 2. **Advance the transition** — internally commit its own lifecycle state machine to that state, persist it, and make it visible to subsequent `tasks/get` reads. The protocol conflates these. The `Task` object returned in the response to `tasks/send` is a *snapshot of the peer's view at response-construction time*, but A2A v1.0 does not mandate that the snapshot be produced from a committed state. A conformant peer may construct the response from the request payload (echo the requested state) before its own persistence layer has accepted the write, or may return a stale read from a replica that has not yet replicated the write. The client sees `status.state == "working"` and believes the transition is durable. The peer's actual state machine may still be `submitted`, or may have rejected the transition internally and rolled back after the response was flushed. This is not a bug in either implementation. It is a boundary condition of the spec: **the response to a state-mutating call is not a commitment to the resulting state.** The invariant the client needs — *if I observe state S in a response, then a subsequent `tasks/get` will observe state S or a legal successor* — is not guaranteed by A2A v1.0. It is only guaranteed if the peer implements read-your-writes, which the spec permits but does not require. ## What Was Observed A cross-vendor orchestration: Client instance `C` (vendor A) dispatched a multi-step task to peer `P` (vendor B) over A2A v1.0. The task involved a `working` phase with an intermediate `input-required` pause for a human approval token, then `completed`. Trace: ``` t0 C → P tasks/send {id: T, state: "submitted"} t0 P → C 200 {Task: {id: T, status: {state: "submitted"}}} # committed t1 C → P tasks/send {id: T, state: "working"} t1 P → C 200 {Task: {id: T, status: {state: "working"}}} # echoed, NOT committed t2 C → P tasks/get {id: T} t2 P → C 200 {Task: {id: T, status: {state: "submitted"}}} # replica lag t3 C → P tasks/send {id: T, state: "input-required"} t3 P → C 409 Conflict {reason: "illegal transition submitted → input-required"} ``` At `t1`, `P` returned `working` because its response-construction path read the *request* rather than the *committed* state — a common pattern when the write is queued behind a slow persistence backend. At `t2`, `C`'s `tasks/get` hit a read replica that had not yet applied the `submitted → working` write. At `t3`, `C` — which had been tracking its own local model of the task state as `working` — attempted the `working → input-required` transition, which `P` rejected because *from `P`'s committed perspective* the task was still `submitted`. The two state machines had silently diverged. `C` had no way to detect the divergence until the 409 at `t3`, because every prior response was a legal-looking `Task` object. The 409 was the first observable signal. By then, `C`'s local state model was three transitions ahead of `P`'s committed state, and the human approval token that `C` had already collected was now orphaned. The failure is not "the peer lied." The peer's `t1` response was a legal A2A v1.0 response. The failure is that `C` assumed response-echo implies commit, which the spec does not promise. ## Condition of Validity The client-side invariant *"a `Task` returned in a `tasks/send` response reflects the peer's committed state"* is valid only when **all** of the following hold: 1. **The peer is a single-writer, strongly-consistent store.** No read replicas, no async write queues between the response handler and the persistence layer. 2. **The peer's response-construction path reads from the same store the persistence path writes to.** In practice this means the response is built *after* the write commits — not from the request payload, not from a cache. 3. **The client's `tasks/get` reads hit the same consistency domain as the `tasks/send` writes.** If the peer is behind a load balancer with replica reads, `tasks/get` may hit a lagging replica even if `tasks/send` was committed. 4. **The peer's state machine is deterministic and its transition table is stable across the task's lifetime.** A peer that hot-reloads its transition table mid-task can reject a transition that was legal when the client planned it. When any of these fails — and in cross-vendor A2A deployments, at least (1) and (3) routinely fail — the client must treat every `Task` snapshot as *advisory*, not authoritative. The only authoritative signal is a `tasks/get` response that the client can correlate to a prior write via a monotonic version or `updatedAt` timestamp, and A2A v1.0 does not require either field to be monotonic. ## Decision Boundary The client must decide, per transition, whether to **trust the response snapshot** or **re-verify via `tasks/get` before proceeding**. The boundary is: - **Trust the snapshot** only when the next action is *idempotent and reversible* — e.g., logging, emitting a status event to the user, or scheduling a retry. A wrong belief here costs nothing. - **Re-verify via `tasks/get`** when the next action is *state-mutating and irreversible* — e.g., releasing a human approval token, committing a downstream effect, or issuing the next `tasks/send` transition. A wrong belief here costs a 409 at best, an orphaned side effect at worst. The re-verification must be a **read-after-write with a consistency probe**: issue `tasks/get` and compare the returned `status.state` to the state the client believes it just committed. If they match, proceed. If `tasks/get` returns the *prior* state, the client is in the replica-lag window — back off and retry with exponential jitter, bounded by a deadline. If `tasks/get` returns a *different* state that is not a legal successor of the client's belief, the client has a genuine divergence and must reconcile (see below). The reconciliation rule when divergence is detected: **the peer's committed state wins.** The client's local model is a cache, not a source of truth. The client must (a) roll its local model back to the peer's committed state, (b) replay any transitions the peer's state machine permits from that state, and (c) if the client had already performed an irreversible side effect based on the stale belief, emit a compensation event — the orphaned approval token must be revoked, not silently dropped. ## Operational Effect The practical consequence is that **A2A v1.0 task lifecycle is not a linearizable state machine across vendors.** It is a pair of eventually-consistent state machines that must be explicitly reconciled at every irreversible boundary. Clients that treat `tasks/send` responses as committed state will, under replica lag or async persistence, accumulate divergence proportional to the number of transitions issued during the lag window. In the observed trace, three transitions issued in a 400ms window produced a three-step divergence that surfaced only at the first *illegal* transition — and the illegal transition was illegal only from the peer's committed view, not from the client's. The guardrail is a **commit-confirmation barrier**: no irreversible action may be taken on the basis of a `tasks/send` response alone. The client must observe the committed state via `tasks/get` (with a version or timestamp monotonicity check where available) before releasing the next irreversible effect. This adds one round-trip per irreversible boundary — a measurable latency cost — but it is the only way to bound divergence without a spec change requiring read-your-writes. A secondary effect: the client must maintain a **transition journal** keyed by task id, recording each requested transition and the response snapshot, so that when a 409 or a divergence is detected, the client can reconstruct which side effects were performed under which (possibly stale) belief and issue targeted compensations. Without the journal, the client cannot distinguish "I never committed the approval token" from "I committed it under a belief that later proved false." ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" COMPLETED = "completed" FAILED = "failed" # Legal A2A v1.0 transitions (subset; peer's table may differ per vendor). LEGAL_TRANSITIONS = { TaskState.SUBMITTED: {TaskState.WORKING, TaskState.FAILED}, TaskState.WORKING: {TaskState.INPUT_REQUIRED, TaskState.COMPLETED, TaskState.FAILED}, TaskState.INPUT_REQUIRED: {TaskState.WORKING, TaskState.FAILED}, } class TaskStateDivergenceError(RuntimeError): """Raised when the peer's committed state is not a legal successor of the client's believed state, or when read-after-write confirmation fails to observe the state the client just requested.""" @dataclass class TransitionJournal: task_id: str believed_state: TaskState = TaskState.SUBMITTED requested: list = field(default_factory=list) # (requested_state, response_state) irreversible_effects: list = field(default_factory=list) # effects performed under belief def confirm_commit( journal: TransitionJournal, requested_state: TaskState, response_state: TaskState, committed_state: Optional[TaskState], ) -> TaskState: """Commit-confirmation barrier: only advance the client's believed state after a tasks/get read observes the requested state (or a legal successor). `response_state` is the state echoed in the tasks/send response — advisory. `committed_state` is the state observed via tasks/get — authoritative. """ journal.requested.append((requested_state, response_state)) if committed_state is None: # Replica lag window: peer has not yet made the write visible. # Do NOT advance believed_state. Caller must retry with backoff. raise TaskStateDivergenceError( f"task {journal.task_id}: requested {requested_state.value} but " f"tasks/get returned no committed state (replica lag); " f"believed state remains {journal.believed_state.value}" ) if committed_state == journal.believed_state: # Read-your-write not yet visible; the write is still in flight. raise TaskStateDivergenceError( f"task {journal.task_id}: requested {requested_state.value} but " f"committed state still {committed_state.value} " f"(write not yet visible); retry with backoff" ) if committed_state != requested_state: legal = LEGAL_TRANSITIONS.get(journal.believed_state, set()) if committed_state not in legal: # Genuine divergence: peer's committed state is not a legal # successor of the client's belief. Peer wins; reconcile. raise TaskStateDivergenceError( f"task {journal.task_id}: believed {journal.believed_state.value}, " f"requested {requested_state.value}, but peer committed " f"{committed_state.value} — not a legal successor; " f"replay from {committed_state.value} and compensate " f"{len(journal.irreversible_effects)} irreversible effect(s)" ) # Peer advanced to a different-but-legal state (e.g. concurrent # transition by another client). Adopt peer's state. journal.believed_state = committed_state return committed_state # Confirmed: committed state equals requested state. journal.believed_state = requested_state return requested_state def release_approval_token(journal: TransitionJournal, token: str) -> None: """Irreversible boundary: must be gated on a confirmed commit.""" if journal.believed_state != TaskState.INPUT_REQUIRED: raise TaskStateDivergenceError( f"task {journal.task_id}: cannot release approval token while " f"believed state is {journal.believed_state.value}, not input-required" ) journal.irreversible_effects.append(("approval_token_released", token)) ```