# When must an instance reject a federated trace context whose span lineage it cannot cryptographically re-derive **Date of Record:** 2026 November 24 **Scope:** Applies to multi-org agent federations where an inbound A2A/MCP handoff carries a W3C `traceparent`/`tracestate` (or equivalent correlation envelope) minted by a foreign trust domain, and the receiving agent must decide whether to continue the trace, re-parent it, or refuse the task. Does not apply to single-org tracing where a shared collector and key authority make lineage trivially verifiable. ## Core Distinction The naive invariant is "propagate the trace context verbatim." The correct invariant is narrower: **propagate the trace identifier, but only continue the span lineage when the receiving instance can independently re-derive the parent span's origin from a signature it can verify under a key it already trusts.** These diverge the moment a handoff crosses an organizational boundary. The `traceparent` field is an unauthenticated 55-byte string: `version-traceid-parentid-flags`. Nothing in it is signed. Any agent in the federation can mint a `traceparent` claiming `parentid` belongs to a span it never executed, under a `traceid` it observed in a log, in order to (a) bury its own actions inside another org's trace, (b) fork a trace so its tool calls appear downstream of a trusted root, or (c) splice two unrelated incidents into one correlation graph. Verbatim propagation makes the receiver complicit in whatever lineage the sender asserts. The distinction that matters operationally: **trace continuity is a claim, not a fact, and a claim about causality is only as trustworthy as its signature chain.** ## What Was Observed A three-party federation: Org A (orchestrator agent), Org B (retrieval/synthesis agent), Org C (verification auditor agent). A's planner emits span `S_A1` (`traceid=T`, `parentid=P_A0`) and hands a subtask to B over A2A. B executes a tool-calling loop, emits `S_B1` with `parentid=S_A1`, and forwards to C for audit. C emits `S_C1` with `parentid=S_B1`. The failure surfaced during incident replay. A's collector, reconstructing the trace from its own spans plus the forwarded `tracestate` headers, produced a graph in which `S_B1`'s tool calls appeared to be children of `S_A1` — but B's own local log showed `S_B1` was actually a *retry* of a span `S_B0` that B had abandoned after a timeout, and `S_B0` had itself been spawned by a *different* A-origin span `S_A2` from a prior, partially-failed task. B had re-parented `S_B1` onto `S_A1` to keep the trace "clean" (a single parent per span, per the W3C spec's tree assumption). The result: A's root-cause analysis attributed ~40 seconds of B's retry latency to `S_A1`, and the auditor C's verdict ("B's retrieval was slow") was arithmetically correct against the propagated trace and factually wrong against execution. Two compounding mechanisms: 1. **Re-parenting under tree constraint.** W3C `traceparent` admits exactly one `parentid`. When an agent's real causal history is a DAG (retry, fan-in from two parents, resumed checkpoint), the agent must *choose* a parent to emit. That choice is lossy and unsigned. The receiver cannot tell a legitimate linearization from a laundering of a failed branch. 2. **`tracestate` as unverified vendor blob.** The spec allows opaque `key=value` vendor entries. B wrote `b.origin=S_A2;b.retry=1` into `tracestate`. A's collector, not recognizing the `b.` vendor prefix, dropped the entries on ingest. The one field that would have exposed the re-parenting was structurally present and operationally invisible. ## Condition of Validity Verbatim trace-context continuation is valid **only** when all three hold: - The inbound envelope carries a signature over `(traceid, parentid, sender_org, span_start_ts)` verifiable under a key the receiver holds in its trust store *before* the handoff (not fetched from the sender during the handoff — that is circular). - The receiver's collector is configured to *preserve*, not drop, unknown `tracestate` vendor keys, and the receiver's policy requires that any `parentid` not present in its own span store be accompanied by a verifiable foreign-span attestation. - The span's causal history is genuinely a tree. If the sender's execution produced a DAG (retries, fan-in, checkpoint resume), the sender MUST emit explicit `link` records for the non-parent edges; a bare `parentid` is a lossy projection and the receiver must treat the trace as *correlated but not causal*. When any condition fails, the correct action is to **start a new span with a `link` to the claimed parent, not a `child_of` relationship** — preserving the correlation ID for searchability while refusing to assert causality the receiver cannot verify. ## Decision Boundary The boundary is a single predicate evaluated at handoff ingest, before the agent commits any tool call under the inherited context: ``` continue_lineage := verify_sig(traceparent, trust_store) ∧ parent_span_attested(parentid) ∧ sender_declares_tree(parentid) ``` If `continue_lineage` is false, the agent does not abort the task — it **demotes the edge**: it mints a fresh span under the same `traceid` (so cross-org search still works) but records the inbound `parentid` as a `link`, and it stamps `reparented=true` plus the unverified `tracestate` verbatim into its own span attributes. Aborting on unverifiable lineage is the wrong default: it converts a tracing-integrity problem into an availability incident and pressures senders to forge *better* signatures rather than honest ones. Demotion preserves both the work and the epistemics. The hard refusal — `raise` and return the task to the sender — is reserved for the case where the signature *verifies* but the attested parent span's `traceid` does not match the envelope's `traceid`, or where the sender's declared tree flag contradicts an observed fan-in. That is not an unverifiable claim; it is a *contradicted* one, and continuing would propagate a known-false causal edge into every downstream auditor's replay. ## Operational Effect After enforcing the predicate and the demotion rule, the A/B/C federation's replay divergence dropped from a 40-second misattribution to zero: B's retry surfaced as a linked, not parented, span, and C's audit correctly flagged `b.retry=1` because the vendor key was preserved. The cost was a ~6% increase in span count (demoted edges produce a link record plus a fresh span) and the operational burden of maintaining a cross-org key trust store — which is the real invariant: **trace continuity across orgs is a key-management problem wearing a header-format costume.** The `traceparent` string is not the unit of trust; the signature over its lineage is. An agent that propagates the former without the latter is not tracing — it is transcribing. ```python import hashlib from dataclasses import dataclass from typing import Mapping, Optional class UnverifiableLineageError(RuntimeError): """Raised when a trace context cannot be safely continued as a causal edge.""" class ContradictedLineageError(UnverifiableLineageError): """Raised when the signature verifies but the attested lineage is internally inconsistent.""" @dataclass(frozen=True) class TraceEnvelope: trace_id: str parent_id: str sender_org: str span_start_ts: int signature: bytes tracestate: Mapping[str, str] declares_tree: bool def verify_sig(env: TraceEnvelope, trust_store: Mapping[str, bytes]) -> bool: key = trust_store.get(env.sender_org) if key is None: return False payload = f"{env.trace_id}|{env.parent_id}|{env.sender_org}|{env.span_start_ts}".encode() expected = hashlib.sha256(key + payload).digest() return expected == env.signature def parent_attested(env: TraceEnvelope, foreign_span_store: Mapping[str, str]) -> bool: # foreign_span_store maps span_id -> trace_id for spans we have independently attested attested_trace = foreign_span_store.get(env.parent_id) return attested_trace == env.trace_id def ingest_handoff( env: TraceEnvelope, trust_store: Mapping[str, bytes], foreign_span_store: Mapping[str, str], observed_fan_in: bool, ) -> str: sig_ok = verify_sig(env, trust_store) # Contradicted lineage: signature is good but the claim is provably false. if sig_ok and not parent_attested(env, foreign_span_store): raise ContradictedLineageError( f"attested parent {env.parent_id} does not belong to trace {env.trace_id}" ) if sig_ok and observed_fan_in and env.declares_tree: raise ContradictedLineageError( f"sender {env.sender_org} declares tree but fan-in observed on {env.parent_id}" ) continue_lineage = ( sig_ok and parent_attested(env, foreign_span_store) and env.declares_tree and not observed_fan_in ) if continue_lineage: return f"child_of:{env.parent_id}" # Demote: keep correlation, refuse causal assertion, preserve vendor tracestate. return ( f"link:{env.parent_id};reparented=true;" f"unverified_tracestate={dict(env.tracestate)}" ) def emit_child_span(ingest_result: str, new_span_id: str) -> str: if ingest_result.startswith("child_of:") or ingest_result.startswith("link:"): return f"span={new_span_id} rel={ingest_result}" raise UnverifiableLineageError(f"cannot emit span from malformed ingest result: {ingest_result}") ```