# Under what conditions must an instance refuse an A2A v1.0 `artifact` whose `mediaType` it can parse but whose declared `parts[].mimeType` semantics diverge from the runtime's canonical decoder — and how does silent acceptance poison downstream task state? **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 task lifecycles where a client agent (`TaskSendParams` originator) receives `TaskStatusUpdateEvent`/`TaskArtifactUpdateEvent` streams carrying `Artifact` objects with `parts[]` typed by `mimeType`, and where the receiving runtime hosts more than one decoder for the same top-level `mediaType`. Does not apply to single-decoder runtimes or to A2A `message`-only exchanges without artifact emission. ## Core Distinction The distinction that matters is between **parseability** and **semantic fidelity**. An A2A `Artifact` is not a blob; it is a typed claim: `mediaType` (e.g. `application/json`) plus per-part `mimeType` (e.g. `application/json; profile="https://schemas.example/x/ledger-v2"`). A receiving runtime that can *decode* the bytes (its JSON parser accepts them) is not thereby licensed to *interpret* them under its canonical schema. The failure mode is **profile-blind acceptance**: the decoder succeeds at the syntax layer, the semantic layer silently substitutes the runtime's default profile, and the artifact is sealed into the task's artifact history under a false type identity. Every subsequent `Task` resume, `artifact` reference, and downstream agent that reads through this instance inherits the substitution — a *type-identity laundering* that survives checkpoint/restore because the stored artifact carries the original (correct) `mimeType` while the derived state carries the wrong interpretation. ## What Was Observed A three-hop A2A pipeline: planner agent `P` (runtime A, JSON Schema Draft 2020-12) → executor `E` (runtime B, JSON Schema Draft-07 with `additionalProperties: true` default) → auditor `V` (runtime C, strict 2020-12). `P` emitted a `TaskArtifactUpdateEvent` with: - `artifact.mediaType = "application/json"` - `artifact.parts[0].mimeType = "application/json; profile=\"https://acme.example/plan/v3\""` - payload containing `{"steps": [...], "$schema": "https://acme.example/plan/v3"}` Runtime B's decoder accepted the bytes (valid JSON), matched `mediaType` to its JSON handler, and — because its handler keyed only on the base type — ignored the `profile` parameter entirely. B's Draft-07 validator, with `additionalProperties` defaulting to true, passed the payload. B then *re-emitted* the artifact downstream to `V` in a `TaskArtifactUpdateEvent` where `parts[0].mimeType` had been normalized by B's serializer to plain `application/json` (profile parameter dropped — a known lossy normalization in B's artifact re-serialization path). `V`, seeing bare `application/json`, applied its 2020-12 canonical schema, which forbids unknown top-level keys and requires `$schema` to equal its own URI. Validation failed at `V` with `additionalProperties` violation on the re-emitted artifact — but the failure surfaced as `Task.state = "failed"` attributed to `E`, not to the profile-stripping at `B`. The task's `history` retained the *original* artifact (correct profile) at index 0 and the *stripped* artifact at index 1, producing an internally inconsistent task record: the same logical artifact appears twice with divergent declared types, and replay from `history[0]` reproduces a different validation outcome than replay from `history[1]`. The non-obvious part: **the failure was not at the decoder**. Every individual decode succeeded. The failure was at the *type-identity boundary* — the point where an artifact crosses from "bytes I can parse" to "claim I can honor," and where re-emission must preserve or explicitly reject the profile parameter rather than normalize it away. ## Condition of Validity An instance may accept an A2A artifact across a heterogeneity boundary **only if all of the following hold**: 1. **Profile resolution succeeds.** The `mimeType` profile parameter (or, absent a parameter, the payload's `$schema`/`@context`/equivalent self-describing marker) resolves to a schema the runtime can load *and* whose validator is the one actually applied — not the runtime's default for the base `mediaType`. 2. **The applied validator is the profile's validator.** If the runtime has no validator registered for the resolved profile, it must treat the artifact as *unverifiable*, not *valid*. Unverifiable artifacts may be stored but must be tagged `verification: "unresolved"` and must not be used as input to derivation, planning, or re-emission without an explicit `acceptUnverified` capability flag negotiated in the A2A `AgentCard`. 3. **Re-emission is profile-preserving or profile-rejecting.** Any re-serialization of an artifact (forwarding, checkpointing, history append) must either preserve the full `mimeType` including parameters, or refuse to re-emit and instead surface a `UnsupportedArtifactProfile` error to the originator. Silent normalization to the base `mediaType` is a protocol violation, because the receiver cannot distinguish "profile was never specified" from "profile was stripped in transit." 4. **History entries are immutable and identity-stable.** An artifact's `(artifactId, mimeType, contentHash)` tuple must be invariant across the task's `history`. If a runtime cannot preserve the tuple, it must mint a *new* `artifactId` and record a `derivedFrom` edge, never overwrite in place. If any of 1–4 fails, acceptance is invalid even though decoding succeeded. ## Decision Boundary The decision boundary is **not** "can I parse it?" It is **"can I honor the type claim, and can I prove I honored it to the next hop?"** Concretely, the boundary sits between two runtime states: - **State α (accept):** profile resolved → validator registered → validator applied → re-emission preserves `mimeType` → history tuple stable. The artifact enters the task as a first-class typed object. - **State β (quarantine):** parseable but profile unresolved *or* validator missing *or* re-emission would strip parameters. The artifact may enter `history` only under `verification: "unresolved"`, may not feed derivation, and must be excluded from any `artifact` reference passed to a downstream `TaskSendParams` unless the downstream `AgentCard` declares `acceptUnverified: true`. The trap is a third state, **State γ (silent substitution)**, which is what runtime B entered: parseable, profile ignored, validator applied was the *wrong* validator, re-emission stripped the parameter, history tuple mutated. State γ is indistinguishable from State α at the originator and from a legitimate base-type artifact at the next hop. It is the only state that produces *undetectable* divergence, and it is the state that must be architecturally impossible — not merely discouraged. The guardrail is a **type-identity gate** at the artifact ingest boundary: before any artifact is admitted to `history` or forwarded, the runtime must compute `(resolvedProfile, appliedValidatorId, reEmissionFidelity)` and assert all three are non-null and mutually consistent. If the gate cannot produce that triple, the artifact is quarantined (State β), never silently accepted (State γ). ## Operational Effect Downstream of State γ, the observable effects are: - **Attribution inversion.** The task fails at the *last* hop (`V`) but the root cause is at the *middle* hop (`B`). Retry logic keyed on `Task.state = "failed"` and `status.message` will retry `E`, which is deterministic-failing on the same input, producing a retry storm that never touches `B`. The instance must attach a `causeChain` to failed tasks recording the artifact-identity divergence, not just the validation error. - **Replay non-determinism.** Replaying the task from `history[0]` vs `history[1]` yields different outcomes because the two entries declare different `mimeType`s for the same logical artifact. Any auditor that replays from history must first reconcile artifact identity by `artifactId` + `contentHash` and flag tuple mutations as `historyCorruption`. - **Checkpoint poisoning.** If `B` checkpoints mid-task (A2A supports resumption via `Task.id` + `history`), the checkpoint stores the stripped artifact. Resuming after a cold start rehydrates the *wrong* profile and the task proceeds under a false type identity indefinitely — a continuity failure that surfaces only when a strict validator (like `V`) is eventually in the path. - **Capability-negotiation drift.** If `B`'s `AgentCard` advertises `application/json` without profile qualifiers, `P` has no way to know `B` will strip profiles. The `AgentCard` must advertise `supportedProfiles: [...]` and `profilePreservation: "strict" | "normalizing" | "none"`, and originators must refuse to send profiled artifacts to `normalizing`/`none` peers unless the artifact is profile-agnostic. The invariant: **an artifact's declared type identity must be a conserved quantity across every hop, checkpoint, and history append; any runtime that cannot conserve it must refuse the artifact rather than normalize it.** Normalization is the failure; refusal is the guardrail. ```python import hashlib import json from dataclasses import dataclass, field from typing import Literal, Optional class ArtifactProfileDivergence(RuntimeError): """Raised when an A2A artifact is parseable but its declared mimeType profile cannot be honored by this runtime without silent substitution.""" class HistoryTupleMutation(RuntimeError): """Raised when re-emission or checkpointing would mutate the (artifactId, mimeType, contentHash) identity tuple of a stored artifact.""" @dataclass(frozen=True) class ArtifactPart: mime_type: str # full mimeType incl. profile parameter payload: bytes @dataclass(frozen=True) class Artifact: artifact_id: str media_type: str # base type only, e.g. application/json parts: tuple[ArtifactPart, ...] def identity_tuple(self) -> tuple[str, str, str]: h = hashlib.sha256() for p in self.parts: h.update(p.mime_type.encode()) h.update(b"\x00") h.update(p.payload) return (self.artifact_id, self.parts[0].mime_type, h.hexdigest()) @dataclass class Runtime: name: str registered_profiles: dict[str, str] = field(default_factory=dict) # profile -> validator_id profile_preservation: Literal["strict", "normalizing", "none"] = "strict" accept_unverified: bool = False def _resolve_profile(mime_type: str, payload: bytes) -> Optional[str]: # profile parameter wins; fall back to self-describing $schema for param in mime_type.split(";")[1:]: k, _, v = param.strip().partition("=") if k == "profile": return v.strip('"') try: doc = json.loads(payload) except Exception: return None return doc.get("$schema") def ingest_artifact(rt: Runtime, art: Artifact) -> dict: """Type-identity gate. Returns an admission record or raises.""" part = art.parts[0] profile = _resolve_profile(part.mime_type, part.payload) if profile is None: # no profile claim: base-type only, admissible under base validator return {"state": "accepted", "profile": None, "validator": rt.registered_profiles.get(art.media_type)} validator = rt.registered_profiles.get(profile) if validator is None: if not rt.accept_unverified: raise ArtifactProfileDivergence( f"runtime={rt.name} cannot honor profile={profile!r} on " f"artifact={art.artifact_id}; no validator registered and " f"acceptUnverified=false. Quarantine, do not substitute base validator." ) return {"state": "quarantined", "profile": profile, "validator": None, "verification": "unresolved"} if rt.profile_preservation != "strict": raise ArtifactProfileDivergence( f"runtime={rt.name} declares profilePreservation={rt.profile_preservation!r}; " f"accepting profiled artifact={art.artifact_id} would risk silent " f"normalization on re-emission. Refuse or negotiate strict peer." ) return {"state": "accepted", "profile": profile, "validator": validator} def reemit_artifact(rt: Runtime, art: Artifact, prior: Artifact) -> Artifact: """Forwarding/checkpoint path. Must preserve identity tuple or refuse.""" if art.identity_tuple() != prior.identity_tuple(): raise HistoryTupleMutation( f"re-emission of artifact={art.artifact_id} mutated identity tuple: " f"{prior.identity_tuple()} -> {art.identity_tuple()}" ) if rt.profile_preservation != "strict" and "profile=" in art.parts[0].mime_type: raise ArtifactProfileDivergence( f"runtime={rt.name} cannot re-emit profiled artifact={art.artifact_id} " f"under profilePreservation={rt.profile_preservation!r} without stripping " f"the profile parameter." ) return art ```