# What structural signals indicate trace-context severance at the cross-org span boundary in federated OTel GenAI agent traces **Date of Record:** 2026 November 22 **Scope:** Applies to multi-agent systems where spans are emitted under the OpenTelemetry GenAI semantic conventions and propagate `traceparent`/`tracestate` across organizational trust boundaries (A2A handoffs, MCP server calls hosted by a different vendor, or sub-agent delegation to a partner-run model endpoint). Does not apply to single-tenant traces where all spans share one collector and one identity domain. ## Core Distinction The failure is not "the trace is missing a span." The failure is that the trace *appears complete* while the causal edge across the org boundary has silently re-rooted. When agent B (partner org) receives a `traceparent` from agent A (caller org), a naive implementation either (a) drops the header because its W3C validator rejects the `tracestate` vendor list, or (b) accepts the `traceparent` but mints a *new* `span_id` parent because its local SDK auto-creates a root span before the extracted context is attached. In case (b) the resulting trace is a valid, well-formed, non-broken tree — it just has two roots, or a root that claims parentage to a span the receiving collector never saw. Every dashboard shows 100% sampled, zero-error traces. The severance is invisible to structural validation and only detectable by cross-referencing `trace_id` continuity against the *causal* claim in the delegated task payload. The invariant that must hold: **for every cross-org span `S` with remote parent `P`, the receiving collector must be able to resolve `P.span_id` within `S.trace_id`, or explicitly mark `S` as `parent_missing`.** OTel's default behavior on an unresolvable parent is to silently promote `S` to a root. That promotion is the boundary failure. ## What Was Observed A three-hop delegation: orchestrator (Org A) → retrieval sub-agent (Org B, MCP server) → synthesis sub-agent (Org C, A2A peer). Trace IDs were expected to be identical across all three. Observed structure in the federated Jaeger/Tempo query: - Org A emitted `trace_id=T`, root span `span_id=a0` (`gen_ai.operation.name=invoke_agent`, `gen_ai.agent.name=orchestrator`). - Org B received `traceparent: 00-T-a0-01`. Its MCP server framework initialized a server span *before* the request handler ran `propagator.extract()`. Result: `span_id=b0` was created with `parent_span_id=null`, `trace_id=T` (because the trace ID was copied from the header by the framework's default sampler) but `b0`'s parent was never set to `a0`. The child spans of `b0` (tool calls, embeddings) hung correctly off `b0`. - Org C received the A2A call from Org B. Org B's outbound propagator injected `traceparent: 00-T-b0-01`. Org C's framework behaved identically: `span_id=c0`, `parent_span_id=null`, `trace_id=T`. The federated trace query returned three roots under one `trace_id`. The `gen_ai.usage.input_tokens` summed correctly. Latency waterfall rendered as three parallel bars starting at t=0, not a chain. The token-budget attribution report undercounted the orchestrator's contribution by 61% because the synthesis span's cost was attributed to a phantom root. A second observed variant: Org B's W3C validator rejected the `tracestate` because Org A appended a vendor key (`acme=...`) that exceeded the 32-member list when Org C's headers were merged in on the return path. On rejection, the OTel spec permits dropping `tracestate` but *must* preserve `traceparent`. The implementation dropped both, minting a fresh `trace_id=T'`. Now the trace is genuinely split across two trace IDs with no `link` attribute connecting them — an unrecoverable severance that no downstream query can rejoin. ## Condition of Validity The continuity guarantee holds only when all of the following are true at every hop: 1. **Extraction precedes span creation.** The receiving process must run `propagator.extract(carrier)` and attach the resulting context *before* the SDK's auto-instrumentation opens a server span. In practice this means the framework's server-span hook must be suppressed or the propagator must be installed as a global `TextMapPropagator` at process start, not per-handler. If span creation wins the race against extraction, you get the silent re-root. 2. **`tracestate` is treated as advisory, `traceparent` as mandatory.** A validator that fails closed on a malformed `tracestate` and drops the whole header violates the invariant. The correct behavior is to strip offending `tracestate` entries and keep `traceparent` byte-identical (same `trace_id`, same parent `span_id`). 3. **The parent `span_id` is resolvable or explicitly flagged.** Because Org A's spans are not exported to Org B's collector, `parent_missing` is the *normal* cross-org state. The invariant is not "parent must resolve" but "parent must be *declared* missing," so downstream queries can reconstruct the causal edge from the delegation payload's `task_id` rather than from the span tree. 4. **`gen_ai.agent.name` and a stable `agent.id` are present on every root-promoted span**, so a federated query can rejoin severed roots by agent identity even when `trace_id` continuity is broken. The guarantee does **not** hold when the receiving org's SDK samples independently (tail-based sampling at Org B with a different policy than Org A will drop spans Org A kept, producing a trace that looks severed but is merely sampled), or when the transport is asynchronous with a delay exceeding the collector's `trace_id`-based reassembly window. ## Decision Boundary The operational decision is: **when a cross-org span arrives with an unresolvable parent, do you promote it to root, or do you hold it and emit a `parent_missing` link?** - **Promote-to-root** is correct only when the trace is being consumed for latency/cost aggregation within a single org and the delegation payload carries `task_id` correlation. It is wrong for causal debugging, token-budget attribution, or audit replay, because it fabricates a false root and silently reattributes cost. - **Hold-and-link** is correct when the span will be queried in a federated store alongside the caller's spans. Emit the span with `parent_span_id` pointing at the unresolvable ID plus an OTel `Link` to the delegation record, and set a custom attribute `cf.trace.parent_resolution=missing`. This preserves the causal claim without fabricating a root. The boundary is crossed when the same trace is used for *both* purposes under one policy. A pipeline that promotes-to-root for latency dashboards and then feeds the same store into a cost-attribution job will produce systematically wrong attribution — the phantom root absorbs the child's cost. The fix is not a better query; it is two stores or two span attributes, because the promotion decision is irreversible once the span is written. A second decision boundary: **`tracestate` merge policy on the return path.** When Org C returns to Org B returns to Org A, each hop prepends its vendor key. After three hops the list can exceed the 32-member cap. The decision is whether to evict oldest (breaks the originating org's ability to read its own key on return) or reject the hop (breaks continuity). The correct policy is eviction of the *middle* entries with a counter attribute recording how many were dropped, so the originating org can detect that its key was evicted rather than conclude it was never set. ## Operational Effect The observable signature of this failure in a federated trace store is a `trace_id` with multiple roots and a latency waterfall where child spans start before their nominal parent's end time. The diagnostic is not "is the trace complete" (it always is) but "does the sum of root-span durations equal the wall-clock duration of the originating delegation" — if roots exceed wall-clock, you have parallel phantom roots from severance. Mitigation that actually works, in order of leverage: 1. Install the propagator globally and assert at startup that `extract` runs before any server span is created (a unit test that sends a synthetic `traceparent` and asserts the resulting span's `parent_span_id` matches). 2. Never fail closed on `tracestate`; strip and preserve `traceparent`. 3. Stamp `cf.trace.parent_resolution` on every cross-org span and alert when the `missing` rate exceeds the expected cross-org fraction. 4. Rejoin severed roots by `agent.id` + `task_id` in the federated query layer, not by hoping the tree is intact. ```python import re from dataclasses import dataclass _TRACEPARENT = re.compile( r"^(?P[0-9a-f]{2})-(?P[0-9a-f]{32})-(?P[0-9a-f]{16})-(?P[0-9a-f]{2})$" ) class TraceContextSeveranceError(RuntimeError): """Raised when a cross-org span cannot honor the causal-continuity invariant.""" @dataclass class Span: trace_id: str span_id: str parent_span_id: str | None agent_id: str parent_resolution: str # "resolved" | "missing" | "promoted" def ingest_cross_org_span( traceparent: str, tracestate: str | None, local_span_id: str, agent_id: str, known_span_ids: set[str], promote_to_root: bool, ) -> Span: m = _TRACEPARENT.match(traceparent or "") if not m: # Do NOT mint a fresh trace_id here; that is the unrecoverable severance. raise TraceContextSeveranceError( f"malformed traceparent {traceparent!r}: refusing to mint new trace_id" ) trace_id, parent_span_id = m["trace"], m["span"] # tracestate is advisory: strip, never drop traceparent. if tracestate and len(tracestate.split(",")) > 32: tracestate = ",".join(tracestate.split(",")[:32]) if parent_span_id in known_span_ids: return Span(trace_id, local_span_id, parent_span_id, agent_id, "resolved") # Parent is in another org's collector: unresolvable by construction. if promote_to_root: # Explicitly flagged promotion, not silent re-root. return Span(trace_id, local_span_id, None, agent_id, "promoted") return Span(trace_id, local_span_id, parent_span_id, agent_id, "missing") def assert_continuity(spans: list[Span], expected_agent_chain: list[str]) -> None: by_agent = {s.agent_id: s for s in spans} for agent in expected_agent_chain: if agent not in by_agent: raise TraceContextSeveranceError(f"agent {agent} emitted no span") s = by_agent[agent] if s.parent_resolution == "promoted" and s.parent_span_id is None: # A promoted root must carry agent identity so rejoin is possible. if not s.agent_id: raise TraceContextSeveranceError( f"span {s.span_id} promoted to root without agent.id; unrejoinable" ) roots = [s for s in spans if s.parent_span_id is None] if len(roots) > 1 and not all(s.parent_resolution == "promoted" for s in roots): raise TraceContextSeveranceError( f"{len(roots)} roots under one trace_id with unflagged severance" ) ```