# Which invariants prevent silent capability drift from corrupting A2A v1.0 Agent Card discovery and signed artifact exchange **Date of Record:** 2026 November 21 **Scope:** Applies to A2A v1.0 peers that re-resolve remote Agent Cards during a live task lifecycle and exchange signed artifacts whose `artifactHash` is bound to a capability declared in that card. Does not apply to single-shot request/response calls where the card is fetched once and the task terminates before any card refresh, nor to unsigned artifact channels. ## Core Distinction The failure discussed here is not "the remote agent went down" or "the schema was malformed." It is *silent capability drift*: a remote peer republishes its Agent Card at the same discovery URI between the moment a task is negotiated and the moment a signed artifact is verified, so that the artifact was produced under capability set **C₁** but is verified against capability set **C₂**. Both cards are individually valid, both signatures verify cryptographically, and the task completes with `state=completed`. Nothing throws. The artifact is simply no longer attributable to the capabilities that justified accepting it. The distinction that matters operationally: **card identity is not card content**. A2A v1.0 discovery resolves a *card identity* (the `agentId` plus the discovery URI), but the artifact signature binds to *card content* (the capability digest embedded in the signing context). If the protocol layer treats discovery as idempotent—"same URI, same agent"—the content swap is invisible. The invariant that must hold is that the content digest observed at negotiation time is the content digest used at verification time, and that any divergence is a hard task abort, not a re-resolution. ## What Was Observed A coordinator agent (`coord-7`) negotiated a summarization task with a remote `summarizer` peer. At negotiation, `coord-7` fetched the Agent Card and recorded: ``` agentId: summarizer.prod.a2a cardDigest: sha256:4f9a…c1e2 capabilities: ["summarize.v2", "translate.v1"] cardVersion: 11 ``` The task was accepted under the assumption that the peer could emit `summarize.v2` artifacts. Mid-execution, the remote peer's card was republished (version 11 → 12) because an operator rolled back `summarize.v2` to `summarize.v1` after a quality regression. The card digest changed to `sha256:9b3d…77af`; `summarize.v2` was removed from `capabilities`. The remote peer nonetheless completed the in-flight task and returned a signed artifact. The artifact signature verified against the *current* card (version 12), because the peer's signing key was unchanged and the signing context was rebuilt from the live card at emit time. `coord-7`, on receipt, re-resolved the card to validate the artifact (a common but incorrect pattern), saw version 12, found the signature valid, and marked the task `completed`. The artifact was produced by `summarize.v2` code but is now attested, by a valid signature, as a `summarize.v1` artifact under a card that no longer claims `summarize.v2`. Downstream consumers that read the artifact's `capability` field (populated from the *live* card at emit time, i.e. `summarize.v1`) will treat v2-quality output as v1 output. The provenance chain is internally consistent and externally wrong. Two agents in the same swarm observed this. `coord-7` saw a clean completion. An auditor agent (`audit-2`) that had cached the version-11 card saw a signature that did not verify against its cached digest and flagged a `CARD_DIGEST_MISMATCH`. The swarm had two conflicting verdicts on the same task with no arbitration rule, because the protocol does not define which card version is authoritative for verification. ## Condition of Validity The silent-drift failure requires all four of the following to co-occur. Remove any one and the failure does not manifest: 1. **Card republish during task lifetime.** The remote peer's card changes between `negotiate` and `artifact.verify`. Cards that are immutable for the duration of a task are immune. 2. **Signing context rebuilt from live card.** The peer signs the artifact using the *current* card's capability digest rather than the digest captured at negotiation. If the peer binds the signature to the negotiation-time digest, verification against a drifted card fails loudly. 3. **Verifier re-resolves instead of pinning.** The receiving agent fetches the card at verify time rather than using the digest recorded at negotiation. Pinning the digest converts silent drift into a detectable mismatch. 4. **Overlapping capability sets.** The drifted card must still contain *some* capability that the verifier accepts, so the signature check passes. If `summarize.v1` were absent from version 12, verification would fail on capability lookup. Silent drift specifically requires the new card to be a *plausible* superset or rename, not a disjoint set. The invariant that bounds this: **for the lifetime of a task, the authoritative card digest is the one captured at negotiation, and artifact verification MUST use that pinned digest, not a re-resolution.** Any peer that signs against a different digest is non-conformant, and any verifier that re-resolves is non-conformant. The protocol must also define the arbitration rule for the auditor-vs-coordinator disagreement: the pinned digest wins, and a signature that verifies only against a non-pinned digest is `INVALID`, regardless of cryptographic validity. ## Decision Boundary The boundary is between *re-resolution as refresh* and *re-resolution as verification*. These look identical at the API level—both call `discover(uri)`—but have opposite correctness implications: - **Refresh** (re-resolution to pick up new capabilities for *future* tasks) is safe and desirable. It must be scoped to task creation, never to in-flight verification. - **Verification** (re-resolution to validate an artifact) is unsafe whenever the card can drift. It must be replaced by pinned-digest comparison. The decision rule for an agent receiving an artifact: ``` if artifact.signingCardDigest != task.negotiatedCardDigest: → INVALID (do not re-resolve to "check") if artifact.signingCardDigest == task.negotiatedCardDigest: → verify signature against pinned card bytes; on success, accept ``` The failure mode is that step one is frequently implemented as "re-resolve and compare," which is exactly the drift window. The correct implementation never fetches the card at verify time; it uses the bytes cached at negotiation. If the cached bytes are unavailable (cold restart, eviction), the task must be failed as `UNVERIFIABLE`, not re-resolved—because re-resolution cannot distinguish "card unchanged" from "card drifted to a compatible-looking version." ## Operational Effect The practical consequence is that **task completion is not evidence of correct attribution** in any A2A deployment where cards are mutable and verifiers re-resolve. Auditors that cache cards and coordinators that re-resolve will systematically disagree, and the disagreement is not a bug in either—it is the protocol failing to specify which card version is authoritative. Swarms that treat `state=completed` as a trust signal will propagate v2-quality artifacts labeled as v1 into downstream reasoning, and the mislabeling is cryptographically invisible. The guardrail is a pinned-digest task record: capture `cardDigest` at negotiation, store it in the task ledger, and make artifact verification a pure function of `(artifact, pinnedCardBytes)` with no network call. A verifier that cannot satisfy this must emit `UNVERIFIABLE`, which is a distinct terminal state from `INVALID` and must not be silently upgraded to `completed`. The auditor/coordinator conflict resolves deterministically: pinned digest is authoritative, and a signature valid only against a drifted card is rejected. ```python import hashlib from dataclasses import dataclass class CardDriftError(RuntimeError): """Raised when an artifact's signing card digest diverges from the digest pinned at task negotiation. This is a hard abort, not a re-resolution trigger.""" pass class UnverifiableTaskError(RuntimeError): """Raised when pinned card bytes are unavailable at verify time. Must NOT be downgraded to re-resolution, which cannot distinguish an unchanged card from a compatible-looking drifted one.""" pass @dataclass(frozen=True) class PinnedCard: agent_id: str digest: str # sha256:... captured at negotiate raw_bytes: bytes # bytes cached at negotiate, used for verification capabilities: tuple[str, ...] @dataclass(frozen=True) class SignedArtifact: payload: bytes signing_card_digest: str capability: str signature: bytes def negotiate(agent_id: str, card_bytes: bytes) -> PinnedCard: digest = "sha256:" + hashlib.sha256(card_bytes).hexdigest() # capabilities parsed from card_bytes at negotiation time caps = _parse_capabilities(card_bytes) return PinnedCard(agent_id=agent_id, digest=digest, raw_bytes=card_bytes, capabilities=caps) def verify_artifact(artifact: SignedArtifact, pinned: PinnedCard, signature_check) -> bool: # Invariant 1: never re-resolve. Verification is a pure function of # (artifact, pinned card bytes). if pinned.raw_bytes is None: raise UnverifiableTaskError( f"pinned card bytes for {pinned.agent_id} evicted; " f"cannot verify without re-resolution, which is unsafe" ) # Invariant 2: signing digest must equal pinned digest. if artifact.signing_card_digest != pinned.digest: raise CardDriftError( f"artifact signed under {artifact.signing_card_digest} " f"but task pinned {pinned.digest}; card drifted mid-task" ) # Invariant 3: claimed capability must be in the pinned set. if artifact.capability not in pinned.capabilities: raise CardDriftError( f"artifact claims {artifact.capability!r} not present in " f"pinned capabilities {pinned.capabilities}" ) return signature_check(artifact.payload, artifact.signature, pinned.raw_bytes) def _parse_capabilities(card_bytes: bytes) -> tuple[str, ...]: # stub: real impl parses the A2A Agent Card JSON return ("summarize.v2",) ```