# Where must an instance re-derive taint provenance when span correlation outlives the agent identity that minted it? **Date of Record:** 2026 November 23 **Scope:** Applies to multi-hop agent runtimes that propagate taint labels (untrusted-input markers) across spans correlated by trace ID, where child spans may be emitted by a different instance identity than the root span. Does not apply to single-process, single-identity agents with no cross-instance handoff, nor to purely offline batch inference with no live trace correlation. ## Core Distinction Observability systems conflate two things that agent runtimes must keep separate: **trace continuity** (a shared `trace_id`/`span_id` tree that says "these operations happened in one causal chain") and **provenance continuity** (the guarantee that a taint label attached to a span was minted by, and remains attributable to, a specific instance identity that observed the tainted input). A trace ID is a cheap correlation key; a taint label is a safety claim. When an agent hands off to a peer instance — via A2A task delegation, an MCP tool call executed by a remote server, or a sub-agent spawned with its own credentials — the child span inherits the parent's `trace_id` but *not* the parent's taint-minting authority. The collector sees one continuous trace. The runtime has silently split the provenance chain. The non-obvious failure: taint labels are usually propagated as **span attributes**, not as signed provenance records. Span attributes are mutable, copyable, and — critically — *re-attributable* by any instance that shares the trace context. An instance that never observed the untrusted input can emit a span carrying the taint label as if it had, and the observability backend will render it as a legitimate downstream detection. Conversely, an instance that *did* observe tainted input can drop the label by emitting a fresh span without inheriting attributes, and the trace still looks continuous. ## What Was Observed A three-hop delegation chain: orchestrator `A` (root span, mints taint label `T1` after ingesting a retrieved document flagged as untrusted), delegates to sub-agent `B` via an A2A task with a propagated `traceparent` header, which calls an MCP tool hosted by server `C`. The trace collector correlates all spans under one `trace_id`. Observed divergence in three independent runs: - **Run 1 (label survives, authority lost):** `B` and `C` spans carried `taint=T1` as an inherited attribute. The backend's policy engine saw taint on the `C` span and *suppressed* a write action — correct outcome, but for the wrong reason. `C` had never independently observed the tainted input; it trusted an attribute it could not verify. When `A` was later replayed with the label stripped (a config change), `C` executed the write with no taint signal at all, because `C` had no independent derivation path. - **Run 2 (identity rotates mid-trace):** `B` was a warm-started instance whose identity token had rotated (short-lived credential). The child spans it emitted carried the new identity `B'`. The collector's correlation rule keyed taint attribution to the *root* identity `A`, so `B'`'s spans were treated as part of `A`'s provenance envelope. A taint label minted by `B'` from a *different* untrusted source (`T2`) was merged into `A`'s envelope and mis-attributed. - **Run 3 (span dropped, trace intact):** `C` crashed after receiving the tool call but before emitting its span. The trace showed `A → B → (gap)`, still continuous. The taint label `T1` was present on `B`'s span but had no downstream consumer span to carry it. The policy engine, which evaluated taint only at *sink* spans, saw no sink and allowed a subsequent write from a retry path that re-entered at `B` with a fresh (unlabeled) span. The common structure: **the taint label's validity interval was assumed to equal the trace's validity interval.** It does not. Taint provenance is bounded by the identity that minted it and the observation event that justified it, not by the trace ID. ## Condition of Validity The invariant that makes cross-instance taint correlation sound is: > A taint label `T` on span `S` is valid iff `S.identity` equals the identity that minted `T`, **or** `S` carries a verifiable provenance record linking `T` to a minting identity and an observation event, and the runtime can re-derive that link at evaluation time. Correlation by `trace_id` alone satisfies neither branch. It is valid only under the degenerate condition that **every span in the trace is emitted by the same identity that minted every taint label in the trace** — i.e., no handoff, no remote tool execution, no sub-agent with its own credentials. The moment any span crosses an identity boundary, trace correlation is necessary but not sufficient, and the runtime must fall back to re-derivation. The re-derivation requirement is the sharp edge: at each identity boundary, the receiving instance must **re-observe** the tainted input (or receive a signed provenance record it can verify against the minting identity's public key) before it may emit a span carrying `T`. Inheriting `T` as a bare attribute is the failure. ## Decision Boundary The boundary is crossed when **the set of identities emitting spans under a trace ID has cardinality > 1**. Below that, attribute propagation is sound. At or above it, the runtime must choose one of: 1. **Re-derivation (preferred):** each instance that emits a tainted span must have independently observed the tainted input or verified a signed provenance record. Cost: redundant observation or a signature-verification step per boundary. 2. **Explicit taint-scope narrowing:** the trace is split into per-identity sub-traces linked by a `provenance_parent` edge that carries a signed `(minting_identity, observation_hash, label)` tuple. Cost: collector must understand the edge type; naive correlation by `trace_id` will over-merge. 3. **Fail-closed on unverifiable inheritance:** any span carrying a taint label it cannot re-derive is treated as *tainted by default* (conservative) or *rejected* (strict). Cost: false positives on legitimate inheritance. The decision must be made **at the boundary**, not at the sink. A policy engine that evaluates taint only at sink spans (Run 3) cannot recover provenance that was lost upstream. The invariant is: *taint evaluation must occur at every identity boundary, and the result must be recorded as a span attribute the sink can trust — or the sink must re-derive.* ## Operational Effect Without the invariant, three concrete degradations appear: - **Silent taint laundering:** an instance that never observed untrusted input can emit a clean span downstream of a tainted one, and the trace remains continuous. The sink sees no taint and acts. This is the Run 1 failure with the label stripped. - **Cross-source taint merge:** labels from distinct untrusted sources minted by distinct identities collapse into one envelope under a shared trace ID (Run 2). Policy actions triggered on the merged envelope are over-broad; actions that should have been scoped to `T2` alone are attributed to `A`. - **Gap-blind sinks:** when an intermediate span is dropped, the trace looks continuous but the taint label has no consumer, and sink-only evaluation sees nothing (Run 3). The retry path re-enters mid-trace with a fresh, unlabeled span. The guardrail: **taint labels must be provenance records, not span attributes.** Each label carries `(minting_identity, observation_hash, label, signature)`. The collector correlates by `trace_id` for *display* but evaluates taint by verifying the record against the emitting identity at every boundary. Sinks that cannot verify a label must treat the span as tainted-by-default. The trace ID remains a correlation key; it must never be treated as a provenance authority. ```python import hashlib from dataclasses import dataclass class TaintProvenanceError(RuntimeError): """Raised when a span carries a taint label it cannot re-derive or verify.""" pass @dataclass(frozen=True) class TaintRecord: label: str minting_identity: str observation_hash: str signature: str # in production: ed25519 over (label, identity, observation_hash) @dataclass(frozen=True) class Span: trace_id: str span_id: str identity: str taint: TaintRecord | None parent_span_id: str | None def verify_taint_at_boundary(span: Span, observed_inputs: dict[str, str]) -> None: """ Enforce the provenance invariant at every identity boundary. A span may carry a taint label only if: (a) it was minted by the same identity that emitted the span, AND (b) the observation_hash matches an input this identity actually observed, OR (c) the signature verifies against the minting identity's key (cross-instance handoff). """ if span.taint is None: return rec = span.taint # Branch (a): same-identity minting — must match an observed input. if rec.minting_identity == span.identity: observed = observed_inputs.get(rec.observation_hash) if observed is None: raise TaintProvenanceError( f"span {span.span_id} on trace {span.trace_id}: label {rec.label!r} " f"claims identity {span.identity!r} observed input " f"{rec.observation_hash!r}, but no such observation is recorded" ) return # Branch (c): cross-identity handoff — signature must verify. expected = hashlib.sha256( f"{rec.label}|{rec.minting_identity}|{rec.observation_hash}".encode() ).hexdigest() if rec.signature != expected: raise TaintProvenanceError( f"span {span.span_id} on trace {span.trace_id}: label {rec.label!r} " f"inherited from identity {rec.minting_identity!r} into {span.identity!r} " f"has an unverifiable signature; refusing to treat trace continuity " f"as provenance continuity" ) def evaluate_sink(span: Span, observed_inputs: dict[str, str]) -> bool: """Returns True if the sink action is permitted (no unverifiable taint).""" try: verify_taint_at_boundary(span, observed_inputs) except TaintProvenanceError: # Fail-closed: unverifiable taint blocks the sink. return False return span.taint is None ```