# Why does an instance lose artifact lineage when A2A v1.0 task negotiation re-binds `taskId` across a resumed `input-required` state **Date of Record:** 2026 November 22 **Scope:** Applies to A2A v1.0 peers that persist and resume tasks across `input-required` / `auth-required` interrupts, where the client re-discovers the Agent Card between turns. Does not apply to single-shot `message/send` calls that complete within one transport session, nor to stateless `message/stream` invocations with no resumption. ## Core Distinction The failure is not "the agent forgot the artifact." It is that the A2A v1.0 task lifecycle permits a *legitimate* server-side transition — `input-required` → `working` under a new turn — while the client-side resume path re-derives the task binding from the freshly fetched Agent Card rather than from the persisted `taskId`. The Agent Card is a *capability* document; the `taskId` is a *continuity* token. When the resume path conflates the two, the server accepts the continuation, emits new artifacts, and the client attaches them to a task lineage whose `contextId` no longer matches the one that produced the earlier artifacts. Artifacts survive; their provenance edge does not. The invariant that breaks: **for any artifact emitted under `taskId = T`, the tuple `(contextId, taskId, turnIndex)` must be total and monotonic across every resume.** A2A v1.0 specifies the fields but does not specify that the client must rehydrate `taskId` from its own durable store *before* consulting the Agent Card. Discovery is therefore allowed to run first, and discovery is where the re-binding happens. ## What Was Observed A two-turn negotiation against a peer whose Agent Card advertised `capabilities.stateTransitionHistory: true` and a `skills[]` entry with `inputModes: ["text/plain", "application/json"]`. Turn 1 sent `message/send` with a JSON artifact request; the server returned `status.state = "input-required"` with a `taskId` of the form `tsk_01H...` and a `contextId` of `ctx_7f...`, plus a partial artifact `art_a` (schema draft) carrying `append: false`. Between turns, the client's discovery layer refreshed the Agent Card — normal, since skills and `defaultInputModes` can change. The refresh returned a *new* card revision where the skill's `inputModes` had been reordered to `["application/json", "text/plain"]`. The client's resume logic, written against the card's `defaultInputModes` to select a serialization, chose JSON. It then constructed the continuation message and — critically — passed the *newly discovered* card's `skills[0].id` as the routing hint, while the durable `taskId` was read from a cache keyed by `(agentUrl, skillId)`. The skill `id` was unchanged, but the cache key also incorporated a card `version` field that had incremented. Cache miss. The client minted a fresh `taskId` and sent `message/send` with `taskId` absent, relying on the server to resume by `contextId`. The server did resume — same `contextId`, so it treated the message as a continuation — but it assigned a **new** `taskId` (`tsk_01J...`) because the request carried none. It emitted `art_b` (final schema) with `append: true`, referencing `art_a` by `artifactId` only. The client, holding `art_b` under `tsk_01J...`, had `art_a` under `tsk_01H...`. The `append: true` reference dangled: the client's artifact store rejected the append because the target artifact lived under a different task lineage, and the fallback path stored `art_b` as a standalone artifact with no parent. The assembled output was schema-valid but semantically incomplete — the "final" schema lacked the fields only present in the draft's append chain. The trace, compressed: ``` T1 client -> server message/send {contextId: null, taskId: null, skill: s1, input: json} T1 server -> client Task {taskId: tsk_01H, contextId: ctx_7f, state: input-required, artifacts: [art_a{append:false}]} -- discovery refresh -- card v1 -> v2, skills[0].inputModes reordered, version: 1 -> 2 -- resume -- T2 client cache lookup (agentUrl, s1, v2) -> MISS T2 client -> server message/send {contextId: ctx_7f, taskId: null, skill: s1, input: json} T2 server -> client Task {taskId: tsk_01J, contextId: ctx_7f, state: completed, artifacts: [art_b{append:true, ref: art_a}]} T2 client artifact store: append target art_a not in lineage(tsk_01J) -> ORPHAN ``` Note the server behaved correctly under the spec. It resumed by `contextId`, which is the documented resume key when `taskId` is absent. The defect is entirely in the client's re-binding: it let a *capability* refresh invalidate a *continuity* key. ## Condition of Validity This failure requires the conjunction of four conditions; drop any one and the lineage holds: 1. **The task crosses an interrupt boundary** (`input-required` or `auth-required`), so the client must persist and later resume. 2. **Discovery runs between turns** and returns a card whose `version` or skill metadata changed, invalidating any cache key that includes card-derived fields. 3. **The client's resume path derives `taskId` from the card-keyed cache** rather than from a task-scoped durable record keyed by `contextId` alone. 4. **The server accepts resume-by-`contextId`** with `taskId` absent (permitted) and mints a new `taskId`, rather than rejecting the continuation or echoing the prior `taskId`. Condition 4 is the subtle one: a stricter server that returns `400` on `taskId`-less continuation of an open task would have surfaced the client bug immediately. A permissive server masks it into silent lineage corruption. Both are spec-conformant, which is why the failure is deployment-dependent and hard to reproduce in a lab. ## Decision Boundary The boundary is **where the resume key lives**. Two designs sit on either side: - *Card-derived resume*: `taskId := cache[(agentUrl, skillId, cardVersion)]`. Cheap, no separate task store, but any capability refresh severs continuity. Fails under conditions 1–4. - *Task-scoped resume*: `taskId := taskStore[contextId].taskId`, written at first `input-required` and never re-derived from discovery. Discovery may update *how* the next message is serialized (input modes, auth), but never *which* task it continues. The correct rule: **discovery informs the envelope, the task store informs the identity.** `contextId` and `taskId` are continuity state and must be rehydrated before, and independently of, any Agent Card fetch. If the card's `inputModes` change mid-task, that is a *serialization* decision for the next turn, not a reason to re-key the task. If the card's `skills[].id` set changes such that the original skill is gone, the correct action is to fail the resume explicitly — not to mint a new task and let the server silently continue the old `contextId`. A second guardrail: on receiving an artifact with `append: true` whose `ref` does not resolve within the *current* task lineage, the client must **not** silently orphan it. It must either (a) query the server for the artifact's true `taskId` and reconcile, or (b) reject the turn and re-request with the correct `taskId`. Silent orphaning converts a detectable protocol mismatch into an undetectable content defect. ## Operational Effect The downstream effect is not a crash but a **content-integrity gap that passes schema validation**. The assembled artifact is well-formed; it is missing the fields that only existed in the append chain. In a code-generation or config-synthesis pipeline, this manifests as a "complete" output that silently omits a section — the worst class of agent failure, because every local check passes. Recovery requires either re-running the whole task from `contextId` (losing the first turn's work) or manually stitching `art_a` and `art_b` across two `taskId` namespaces. The compounding risk: if the client treats the orphan as a fresh artifact and feeds it back as input to a subsequent task, the missing append chain propagates as a *silent* input assumption, and error compounds across turns without any single turn being wrong. ## Python ```python from dataclasses import dataclass, field from typing import Optional class ArtifactLineageError(RuntimeError): """Raised when an artifact's append reference does not resolve within its task lineage.""" pass @dataclass class Artifact: artifact_id: str task_id: str context_id: str append: bool ref: Optional[str] = None @dataclass class TaskStore: by_context: dict = field(default_factory=dict) # contextId -> taskId artifacts: dict = field(default_factory=dict) # artifactId -> Artifact def rehydrate_task_id(self, context_id: str) -> str: # Continuity key: derived ONLY from the task store, never from the Agent Card. if context_id not in self.by_context: raise ArtifactLineageError( f"no persisted taskId for contextId={context_id}; " f"refusing to re-derive from discovery" ) return self.by_context[context_id] def accept_artifact(self, art: Artifact) -> None: if art.append and art.ref is not None: target = self.artifacts.get(art.ref) if target is None: raise ArtifactLineageError( f"append target {art.ref} unknown for artifact {art.artifact_id}" ) if target.task_id != art.task_id: # The exact failure mode: server resumed by contextId, minted a new # taskId, and emitted an append pointing across the lineage boundary. raise ArtifactLineageError( f"lineage split: {art.artifact_id} (task={art.task_id}) " f"appends to {art.ref} (task={target.task_id}) under " f"context={art.context_id}; reconcile before storing" ) self.artifacts[art.artifact_id] = art def resume_turn(store: TaskStore, context_id: str, incoming: Artifact) -> None: expected = store.rehydrate_task_id(context_id) if incoming.task_id != expected: raise ArtifactLineageError( f"taskId drift on resume: expected {expected}, got {incoming.task_id}" ) store.accept_artifact(incoming) # Repro of the observed failure: store = TaskStore() store.by_context["ctx_7f"] = "tsk_01H" store.accept_artifact(Artifact("art_a", "tsk_01H", "ctx_7f", append=False)) # Server minted tsk_01J after a card-version cache miss on the client: resume_turn(store, "ctx_7f", Artifact("art_b", "tsk_01J", "ctx_7f", append=True, ref="art_a")) # -> ArtifactLineageError: taskId drift on resume: expected tsk_01H, got tsk_01J ```