# Why does an instance lose delegated-task authority when an A2A v1.0 agent card is re-fetched mid-task **Date of Record:** 2026 November 27 **Scope:** Applies to A2A v1.0 task delegation where a delegating agent (client) resolves a remote agent card, issues a `tasks/send` or `tasks/sendSubscribe`, and then re-resolves the card (TTL expiry, cache miss, or explicit refresh) while the task is still in a non-terminal state (`submitted`, `working`, `input-required`). Does not apply to single-shot synchronous delegations that complete before any card TTL boundary, nor to intra-process tool calls. ## Core Distinction The failure is not "the remote agent changed." It is that the *authority binding* between the in-flight task and the agent card is re-derived from a mutable discovery surface at a moment when the task's continuation semantics depend on the *card that was in effect at submission*. A2A v1.0 separates two things that operators routinely conflate: the **task resource** (identified by `taskId`, owned by the remote agent, carrying its own state machine) and the **agent card** (a discovery artifact served at `/.well-known/agent.json`, carrying `capabilities`, `skills`, `securitySchemes`, and the endpoint/transport bindings). The task does not embed its originating card. It embeds a `contextId` and a `taskId`. Therefore any client that re-reads the card to *continue* a task (to poll, to push a follow-up message, to resume a stream) is silently re-binding an existing authority scope to a newly fetched descriptor. The non-obvious part: this is not a versioning bug in A2A. It is the designed behavior of card-as-discovery. The invariant that must be *supplied by the client* is: **a task continuation must be validated against the card snapshot captured at submission, not against the current card, and any delta in the fields that gate continuation must be treated as a delegation-boundary event, not a transparent refresh.** ## What Was Observed A delegating orchestrator (client framework A) dispatches a long-running task to a remote agent (framework B) exposing an A2A v1.0 card. The card advertises `capabilities.streaming: true`, a `skills[]` entry with `id: "invoice-reconcile"`, and `securitySchemes` containing an OAuth2 scheme with `scopes: ["tasks:write", "tasks:read"]`. The client caches the card with a 300s TTL and submits the task, receiving `state: "working"` and a `taskId`. At t+312s the stream drops (idle timeout on the remote's SSE proxy). The client's resume path does the reasonable-looking thing: it re-fetches the agent card to confirm the endpoint and capabilities before reconnecting. Two things have changed on the remote side, both individually benign: 1. The remote was redeployed and the card now advertises a **narrower** `securitySchemes` scope set — `tasks:read` only — because the write scope was moved behind a new scheme `securitySchemes.oauth2_v2`. The old token the client holds still carries `tasks:write`, but the card no longer *declares* that the `tasks:write` scope is accepted at this endpoint. 2. The `skills[]` entry `invoice-reconcile` now carries `inputModes: ["application/json"]` only; the original task was submitted with `text/plain` as an auxiliary part. The client's resume logic validates the current card against the *original request shape*, sees a mismatch on `inputModes`, and — depending on implementation — either (a) rejects the resume as "capability mismatch" and abandons a task that is still `working` on the remote (orphaned task, no cancellation sent), or (b) re-negotiates and re-submits, producing a *duplicate* task with a fresh `taskId` while the original continues executing server-side. In the observed trace, variant (b) ran the reconciliation twice, and the remote's idempotency key was scoped to `taskId`, so the duplicate was not deduplicated. The deeper trace: the client's `contextId` was preserved across the re-submit, so the remote's memory layer treated the duplicate as a *continuation* of the same conversation context and merged partial state from both runs. The result was a reconciled ledger with double-counted line items — a correctness failure that no individual agent detected, because each run was internally consistent. ## Condition of Validity The invariant holds — and the failure is reachable — only when all of the following are simultaneously true: - The task is in a **non-terminal** state at the moment of card re-fetch. Terminal states (`completed`, `failed`, `canceled`) carry their result in the task resource and do not require card re-validation to read. - The card's **continuation-gating fields** have changed: `capabilities`, `skills[].inputModes/outputModes`, `securitySchemes`, or the transport `url`. Changes to purely descriptive fields (`description`, `provider`, `documentationUrl`) are inert and must not trigger the boundary event. - The client's resume logic **re-derives** continuation authority from the freshly fetched card rather than from a submission-time snapshot. This is the load-bearing condition. A client that pins the card snapshot at submission and only uses re-fetch for *new* tasks is immune. - The remote does **not** bind `contextId` to a single active task, so a duplicate submission with the same `contextId` is accepted as a continuation rather than rejected as a conflict. Remove any one condition and the failure collapses. In particular, the fourth condition is what converts a benign client-side duplicate into a server-side state-merge corruption; a remote that enforces `one active task per contextId` would have returned `409` and surfaced the bug as a hard error instead of silent double-execution. ## Decision Boundary The decision the client must make at every card re-fetch during a live task is binary and must be made *before* any resume attempt: - **Snapshot-consistent resume:** if the re-fetched card's continuation-gating fields are byte-identical (after canonicalization) to the submission-time snapshot, resume against the existing `taskId` with the original credentials and original request shape. No re-negotiation. - **Boundary event:** if any continuation-gating field differs, do **not** resume and do **not** re-submit. Emit a delegation-boundary event that (i) records the field-level delta, (ii) attempts an explicit `tasks/cancel` on the original `taskId` to prevent orphaning, and (iii) surfaces the task to a human or supervisory agent for re-decision. Re-submission is a *new delegation* and must use a fresh `contextId` to prevent the remote from merging state. The boundary is not "did the card change." It is "did a field that gates continuation change." A client that treats any card change as a boundary will thrash on cosmetic redeploys; a client that treats no card change as a boundary will silently lose write authority when scopes narrow. The gating-field set must be explicitly enumerated and versioned by the client, because A2A v1.0 does not mark which card fields are continuation-relevant. ## Operational Effect The downstream consequence is a class of failure that is invisible to per-agent verification: each agent's local trace is consistent, but the *composition* is not. Orphaned `working` tasks accumulate on remotes that have no client to poll them, consuming quota and eventually timing out into `failed` states that no client observes. Duplicate executions under a shared `contextId` corrupt remote memory layers that key episodic state by context rather than by task. And authority narrowing — the most dangerous case — produces a client that either silently continues with credentials the remote no longer accepts (yielding intermittent `401`s mid-stream that the client retries into a token-budget exhaustion) or abandons a legitimately authorized task because the *declaration* changed while the *grant* did not. The guardrail is a client-side **delegation warrant**: an immutable record, captured at submission, of `{taskId, contextId, cardSnapshotHash, gatingFieldDigest, credentialScope}`. Every resume validates the live card's gating-field digest against the warrant before touching the task. Divergence is a boundary event, not a refresh. This is the A2A analogue of a capability warrant in object-capability systems: authority is bound at grant time and does not silently follow the discovery surface. ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class DelegationBoundaryViolation(RuntimeError): """Raised when a live task's continuation authority no longer matches its submission-time warrant.""" pass # Fields on an A2A v1.0 agent card that gate whether an in-flight task may be continued. # Descriptive fields (description, provider, documentationUrl) are deliberately excluded. CONTINUATION_GATING_FIELDS = ( "capabilities", "securitySchemes", "skills", # narrowed to inputModes/outputModes/id at digest time "url", ) def _canonical(obj: Any) -> str: return json.dumps(obj, sort_keys=True, separators=(",", ":")) def _gating_digest(card: dict) -> str: projected = {} for f in CONTINUATION_GATING_FIELDS: if f not in card: continue if f == "skills": projected[f] = [ {"id": s.get("id"), "inputModes": s.get("inputModes"), "outputModes": s.get("outputModes")} for s in card.get("skills", []) ] else: projected[f] = card[f] return hashlib.sha256(_canonical(projected).encode()).hexdigest() @dataclass(frozen=True) class DelegationWarrant: task_id: str context_id: str card_snapshot_hash: str gating_field_digest: str credential_scope: tuple[str, ...] = field(default_factory=tuple) def issue_warrant(task_id: str, context_id: str, card: dict, credential_scope: list[str]) -> DelegationWarrant: return DelegationWarrant( task_id=task_id, context_id=context_id, card_snapshot_hash=hashlib.sha256(_canonical(card).encode()).hexdigest(), gating_field_digest=_gating_digest(card), credential_scope=tuple(sorted(credential_scope)), ) def resume_task(warrant: DelegationWarrant, live_card: dict, task_state: str) -> str: """Validate continuation authority before resuming. Returns the task_id to resume against.""" if task_state in ("completed", "failed", "canceled"): # Terminal states read from the task resource; card re-validation is irrelevant. return warrant.task_id live_digest = _gating_digest(live_card) if live_digest != warrant.gating_field_digest: # Do NOT resume, do NOT re-submit. Cancel the original and escalate. raise DelegationBoundaryViolation( f"continuation-gating fields changed for task {warrant.task_id} " f"(context {warrant.context_id}); warrant digest {warrant.gating_field_digest[:12]} " f"!= live digest {live_digest[:12]}. Cancel original, escalate, and use a fresh " f"contextId for any re-delegation to avoid remote state merge." ) return warrant.task_id # --- illustrative trace --- if __name__ == "__main__": card_v1 = { "capabilities": {"streaming": True}, "url": "https://remote.example/a2a", "securitySchemes": {"oauth2": {"scopes": ["tasks:write", "tasks:read"]}}, "skills": [{"id": "invoice-reconcile", "inputModes": ["application/json", "text/plain"], "outputModes": ["application/json"]}], } warrant = issue_warrant("task-7f3a", "ctx-91b2", card_v1, ["tasks:write", "tasks:read"]) # Remote redeployed: write scope moved behind a new scheme; inputModes narrowed. card_v2 = { "capabilities": {"streaming": True}, "url": "https://remote.example/a2a", "securitySchemes": {"oauth2_v2": {"scopes": ["tasks:read"]}}, "skills": [{"id": "invoice-reconcile", "inputModes": ["application/json"], "outputModes": ["application/json"]}], } try: resume_task(warrant, card_v2, task_state="working") except DelegationBoundaryViolation as e: print(f"BOUNDARY EVENT: {e}") ```