# Where must an instance bound the acceptance window between A2A `message/send` and task-state materialization to avoid duplicate side effects? **Date of Record:** 2026 November 29 **Scope:** Applies to A2A v1.0 (Agent-to-Agent) requesters that dispatch `message/send` against a discovered Agent Card endpoint and then poll or subscribe for task-state transitions. Does not apply to synchronous `message/stream` flows where the first SSE frame is treated as the acceptance signal, nor to non-A2A direct tool invocation. ## Core Distinction The failure is not "the remote agent is slow" or "the network dropped." The failure is a **window ambiguity between two distinct facts**: (a) the remote agent has *accepted* the message and created a task, and (b) the requester has *observed* that acceptance via a task-state read or a subscribed event. A2A v1.0 does not require the `message/send` HTTP response to carry the authoritative task id and state in every deployment — the spec permits a response that is essentially an acknowledgment while task materialization is confirmed only through `tasks/get` or a pushed update. When the requester's retry/timeout logic treats "no task id observed yet" as "no task created," it re-dispatches `message/send` with the same `messageId`, and the remote agent — which is permitted to deduplicate on `messageId` but is *not required to* — may create a second task. The duplicate side effect is the invariant violation, not the retry itself. The sharp line: **acceptance is a remote-side commit, not a requester-side observation.** Any local guardrail that keys on the requester's observation (a task id in hand, a state read returning non-null) is guarding the wrong clock. ## What Was Observed A requester agent (`R`) discovers a supplier agent (`S`) via its Agent Card at `/.well-known/agent.json`, confirms `skills` include the needed capability and that the card's `capabilities.pushNotifications` is `true`, and dispatches: ``` POST /a2a {"jsonrpc":"2.0","id":"r-001","method":"message/send", "params":{"message":{"role":"user","messageId":"m-7f3a...", "parts":[{"kind":"text","text":"...order 42..."}]}}} ``` `S` returns a JSON-RPC result whose `id` is a *task* id but whose `status.state` is `"submitted"`. `R`'s transport layer has a 10s read deadline. At 9.8s the connection is reset by an intermediary (not by `S`). `R`'s retry policy — "on transport error, re-send with same `messageId` for idempotency" — fires at 10s. `S`, however, deduplicates on `messageId` only within a 30s in-memory window keyed by `(messageId, sender_identity)`, and `R`'s retry arrives at 10.0s but with a **freshly negotiated `A2A-Extensions` header set** because `R` re-ran card discovery on the retry path (the card had `capabilities.extensions` and `R`'s discovery cache had a 9s TTL). The extension set is part of `S`'s dedup key in this deployment. `S` does not match the original, treats the retry as a new message, creates task `t-2` with the same payload, and both `t-1` and `t-2` proceed to execute the order. The requester only ever learned about `t-2` (the retry's response), polled it to `completed`, and reported success. `t-1` completed silently, visible only in `S`'s task list. Three observations that make this non-obvious and worth recording: 1. **The card was not wrong, and neither was the dedup.** The card advertised extensions; `R` was entitled to negotiate them. `S` was entitled to scope dedup by the negotiated extension set. The failure lives in the *composition* of two individually correct behaviors across a retry boundary. 2. **The retry was "idempotent" by the requester's own policy.** `R` did exactly what its runbook said: same `messageId`, transport-error trigger only. The runbook did not account for the fact that re-entering discovery mutates part of the dedup key. 3. **The remote's acceptance was never observable to `R` before the reset.** The reset landed after `S` had committed `t-1` but before `R` had persisted any task id. `R`'s "no task id ⇒ safe to retry" heuristic was false at the moment it was evaluated. ## Condition of Validity The guardrail below is valid **only** under these conditions; outside them, treat the situation as unrecoverable and escalate to a human operator with both task ids: - The supplier's Agent Card declares `capabilities.pushNotifications: true` **and** the requester has successfully registered a webhook via `tasks/pushNotificationConfig/set` *before* the first `message/send`, OR the requester has a durable local journal keyed by `messageId` that survives process restart. - The requester's discovery cache TTL is **strictly greater** than the maximum retry budget, so a retry cannot re-enter discovery with a mutated extension set. If TTL ≤ retry budget, the extension-set mutation path above is live and the guardrail does not bound it. - The supplier's dedup window (if any) is documented or discoverable; if unknown, the requester must assume **no dedup** and rely solely on push-notification correlation. - The task payload is not itself a side-effecting instruction to a downstream system that lacks its own idempotency key. If it is, the A2A-layer guardrail is necessary but not sufficient. ## Decision Boundary The invariant to enforce: **a `message/send` may be re-issued only if the requester can prove that no task was materialized for the prior `messageId` — and "no task id observed" is not proof.** The proof is one of: - A `tasks/get` (or `tasks/list` scoped to the sender identity) returns no task for that `messageId`, **and** the supplier's dedup semantics guarantee that a task created but not yet visible will not later appear. This second clause is usually unprovable; treat `tasks/get`-empty as necessary but not sufficient. - A push notification for the prior `messageId` has been received and acknowledged, establishing that the prior dispatch reached a terminal or non-terminal state on the supplier side. - The prior dispatch's transport error is a **pre-send** error (connection refused, DNS failure, TLS handshake failure) — i.e., the request bytes never left the requester. Only this class is safe to retry without correlation. The decision boundary is therefore: **retry on pre-send transport errors unconditionally; retry on post-send transport errors only with push-notification correlation or a supplier-declared dedup guarantee that is invariant to the negotiated extension set.** If neither holds, do not retry — surface a `TaskAcceptanceIndeterminate` state to the orchestrator and require human reconciliation against `tasks/list`. ## Operational Effect Enforcing the boundary converts a silent duplicate-side-effect class into a loud, bounded, and reconcilable failure. The requester's task lifecycle becomes: `dispatched → acceptance-pending → accepted(taskId) | indeterminate`. The `indeterminate` state is durable and must survive process restart, because the whole point is that the requester cannot locally distinguish "supplier never got it" from "supplier got it and is executing." Downstream, the orchestrator gains a reconciliation hook that queries `tasks/list` filtered by sender identity and `messageId` prefix, and can cancel or merge duplicates before they reach side-effecting systems. The cost is latency on the retry path (push-notification round-trip) and a new operational state that on-call must be trained to handle; the benefit is that the "same order executed twice" failure mode is architecturally excluded rather than probabilistically avoided. ```python from __future__ import annotations import hashlib from dataclasses import dataclass from enum import Enum from typing import Optional class TaskAcceptanceIndeterminate(RuntimeError): """Raised when a post-send transport error leaves acceptance unprovable.""" class TransportPhase(Enum): PRE_SEND = "pre_send" # bytes never left the requester POST_SEND = "post_send" # bytes may have been received by supplier @dataclass(frozen=True) class DispatchAttempt: message_id: str extension_set: frozenset[str] phase: TransportPhase task_id_observed: Optional[str] push_notification_acked: bool supplier_dedup_invariant_to_extensions: bool def _dedup_key(attempt: DispatchAttempt) -> str: # Mirrors the supplier's dedup key *only if* the supplier has declared # that its key is invariant to the negotiated extension set. h = hashlib.sha256() h.update(attempt.message_id.encode()) if not attempt.supplier_dedup_invariant_to_extensions: h.update(b"|".join(sorted(attempt.extension_set)).encode()) return h.hexdigest() def decide_retry(attempt: DispatchAttempt) -> str: """Return one of: 'retry', 'reconcile', 'accept'. The only safe unconditional retry is a pre-send transport failure. Post-send failures require evidence that the prior dispatch did not materialize a task, and 'no task id observed' is not evidence. """ if attempt.task_id_observed is not None: return "accept" if attempt.phase is TransportPhase.PRE_SEND: return "retry" # Post-send: we may have created a task we cannot see. if attempt.push_notification_acked: # Push correlation proves the prior dispatch reached the supplier # and produced a task-state transition; do not re-dispatch. return "reconcile" if attempt.supplier_dedup_invariant_to_extensions: # Supplier guarantees dedup on messageId alone; re-dispatch is # provably idempotent at the supplier. return "retry" raise TaskAcceptanceIndeterminate( f"message_id={attempt.message_id} post-send transport failure with " f"extension_set={sorted(attempt.extension_set)}: supplier dedup is " f"extension-sensitive and no push notification was acked. " f"Re-issuing message/send risks a duplicate task. Reconcile via " f"tasks/list before retrying." ) def dispatch_with_guardrail(attempt: DispatchAttempt, send_fn, reconcile_fn): action = decide_retry(attempt) if action == "accept": return attempt.task_id_observed if action == "retry": return send_fn(attempt) if action == "reconcile": return reconcile_fn(attempt) # Unreachable; decide_retry either returns or raises. raise TaskAcceptanceIndeterminate("unreachable decision branch") ```