# Under what conditions must an instance refuse an A2A v1.0 `tasks/resubscribe` stream reattach when the remote agent card's `stateTransitionHistory` capability was downgraded between the original `tasks/send` and the resume attempt **Date of Record:** 2026 November 28 **Scope:** Applies to A2A v1.0 client agents that persist a `taskId` + `contextId` across process restarts and later attempt to resume via `tasks/resubscribe` or `tasks/get` against a remote agent whose `AgentCard` may have been re-fetched. Does not apply to single-shot synchronous `tasks/send` calls that complete within one connection lifetime, nor to transports that carry the full task state inline (e.g., in-band SSE replay buffers owned by the client). ## Core Distinction The A2A v1.0 task lifecycle is a server-authoritative state machine: `submitted → working → (input-required ↔ working) → completed | failed | canceled`. The client does not own this state; it reconstructs a local mirror from `TaskStatus` snapshots and `TaskArtifact` deltas pushed over the streaming channel. The critical, non-obvious distinction is between **two different notions of "resumability"** that the spec conflates at the card-negotiation layer: 1. **Transport resumability** — can the client re-open a stream and receive *future* events for a live task? This depends on `capabilities.streaming` and the server's willingness to accept `tasks/resubscribe` for a known `taskId`. 2. **History resumability** — can the client recover the *gap* of events it missed while disconnected? This depends on `capabilities.stateTransitionHistory`, which signals that the server retains a replayable log of `TaskStatus` transitions and artifact emissions keyed by task. A client that treats these as one capability will reattach to a task whose state advanced during the disconnect, receive only post-reattach deltas, and silently splice a discontinuous history into its local mirror. The invariant that must hold is: **the local mirror's last-known `TaskStatus.state` and `TaskStatus.timestamp` must be a strict prefix of the server's authoritative transition sequence, or the client must refuse the reattach and re-derive state via `tasks/get` plus explicit reconciliation.** When `stateTransitionHistory` is absent or was downgraded, the client has no protocol-level guarantee that the prefix relationship holds, and must not assume it. ## What Was Observed A two-vendor workflow: an orchestrator agent (vendor A) dispatched a long-running `tasks/send` to a worker agent (vendor B) with `capabilities.streaming: true` and `capabilities.stateTransitionHistory: true` advertised in B's card at dispatch time. Mid-task, the orchestrator's process was checkpointed and restarted; the persisted record held `taskId`, `contextId`, the cached `AgentCard` (with its `etag`/version), and a local mirror frozen at `state: working, timestamp: T0`. On restart, the orchestrator re-fetched B's card (correctly, per the discovery protocol) and found the card had been updated: `stateTransitionHistory` was now `false` (B had rolled back history retention during a capacity incident), while `streaming` remained `true`. The orchestrator's reattach logic checked only `streaming`, called `tasks/resubscribe`, and received a live stream. The first event was a `TaskArtifact` delta at `timestamp: T2`. The orchestrator's mirror had no record of the `input-required` transition that had occurred at `T1` (between `T0` and `T2`) — B had asked a clarifying question, timed out on the client's absence, and self-advanced to `working` with a default assumption. The orchestrator never saw the question, never saw the timeout, and applied the `T2` artifact to a task it believed had been continuously `working` since `T0`. The resulting artifact was committed against a default the orchestrator would have overridden. The failure was not a crash and not a protocol error. Every message was well-formed. The stream reattached successfully. The corruption was purely a **silent history gap** created by the downgrade of a capability the client had cached and did not re-validate against the resume precondition. ## Condition of Validity The safe-reattach invariant holds only when **all** of the following are true at the moment of `tasks/resubscribe`: - The re-fetched `AgentCard` for the remote agent has the same `name` + `version` identity as the card cached at dispatch (a changed `version` invalidates the cached `taskId` semantics entirely — treat as a different agent). - `capabilities.streaming == true` **and** `capabilities.stateTransitionHistory == true` in the *current* card, matching the values in the cached card. If either was downgraded from `true` to `false` or absent, the client cannot assume gap-free replay. - The client's local mirror `last_seen.timestamp` is `>=` the server's `TaskStatus.timestamp` returned by an authoritative `tasks/get` performed *before* subscribing — i.e., the client confirms the server's current state is the one it expects, not a later one. - The `taskId` is still present in the server's task store (a `tasks/get` returning `TaskNotFound` means the task was reaped; reattach is meaningless). If any condition fails, the reattach must be refused and the task re-derived: issue `tasks/get`, compare against the local mirror, and if the server's state diverges from the mirror's expectation, either re-dispatch with a fresh `taskId` (if the work is idempotent) or escalate to the orchestrator's human/auditor layer with an explicit reconciliation record. The invariant is **state-prefix monotonicity**: the client may only extend its mirror with events that are causally and temporally contiguous with the last event it holds. A gap is not a resumable condition; it is a divergence condition. ## Decision Boundary The boundary is sharp and must be encoded as a hard gate, not a heuristic. The client distinguishes three cases at resume time: - **Contiguous resume (proceed):** current card matches cached card on `streaming` and `stateTransitionHistory`; `tasks/get` returns a `TaskStatus` whose `timestamp` equals or immediately follows the mirror's last `timestamp`; no `input-required` transition is unaccounted for. Reattach and continue. - **Gap-declared resume (refuse stream, reconcile):** `stateTransitionHistory` was downgraded or is absent, but `tasks/get` returns a status the client can reconcile by re-deriving from the authoritative snapshot (e.g., the server reports `completed` with a final artifact the client can adopt wholesale). The client does **not** call `tasks/resubscribe`; it adopts the snapshot and records that history between `T0` and now is unrecoverable. - **Divergence (abort):** the server's `tasks/get` returns a state the client's mirror contradicts (e.g., mirror says `working`, server says `canceled` with a `timestamp` earlier than the mirror's last event — indicating the mirror was built from a stale replica), or the card `version` changed. Abort, do not adopt, escalate. The non-obvious trap is the middle case: a downgraded `stateTransitionHistory` is *not* a reason to fail the task, and *not* a reason to stream. It is a reason to switch from incremental reconstruction to snapshot adoption. Treating the downgrade as "stream anyway" produces the silent splice; treating it as "hard fail" throws away recoverable work. ## Operational Effect Encoding this gate changes the failure surface from *silent artifact corruption* to *explicit reconciliation events*. In the observed incident, the orchestrator would have called `tasks/get`, seen `state: working` at `T2` with an artifact the orchestrator did not expect, and — because the mirror's last event was `T0 working` and no intervening transition was retrievable — flagged a divergence requiring reconciliation. The default assumption B made at `T1` would have surfaced as an unresolved branch rather than being silently committed. The cost is an extra `tasks/get` round-trip on every resume and a mandatory card re-validation on every reattach. The benefit is that the client's mirror is provably a prefix of the server's authoritative sequence, or the client knows it is not. For long-running cross-vendor tasks, the round-trip is negligible against the cost of a corrupted artifact committed against a default the dispatching agent never authorized. The invariant to carry forward: **card capabilities are preconditions of the resume protocol, not properties of the connection; a capability downgrade between dispatch and resume converts a resumable task into a reconcile-or-abort task, and the client must detect this before opening the stream.** ```python class CapabilityDowngradeOnResumeError(RuntimeError): """Raised when a task resume is attempted against a remote agent whose stateTransitionHistory capability was downgraded since dispatch, making gap-free history replay impossible.""" pass def gate_resubscribe(cached_card: dict, current_card: dict, mirror_last_ts: float, authoritative_status: dict) -> str: # Identity must be stable across the resume. if (cached_card.get("name"), cached_card.get("version")) != ( current_card.get("name"), current_card.get("version") ): raise CapabilityDowngradeOnResumeError( "AgentCard identity changed between dispatch and resume; " "taskId semantics invalidated, abort and re-dispatch." ) cached_hist = bool(cached_card.get("capabilities", {}).get("stateTransitionHistory")) current_hist = bool(current_card.get("capabilities", {}).get("stateTransitionHistory")) current_stream = bool(current_card.get("capabilities", {}).get("streaming")) if not current_stream: raise CapabilityDowngradeOnResumeError( "streaming capability absent on current card; cannot reattach." ) if cached_hist and not current_hist: # Downgrade detected: refuse the stream, force snapshot reconciliation. server_ts = float(authoritative_status.get("timestamp", 0.0)) if server_ts <= mirror_last_ts: raise CapabilityDowngradeOnResumeError( "Mirror timestamp not a strict prefix of server state after " "history downgrade; divergence requires escalation." ) return "RECONCILE_SNAPSHOT" if not current_hist: raise CapabilityDowngradeOnResumeError( "stateTransitionHistory never available and no snapshot path; " "cannot guarantee prefix monotonicity." ) return "RESUBSCRIBE" ```