# How does an instance detect a broken cross-org span link when GenAI semantic-convention trace correlation silently degrades to orphaned spans **Date of Record:** 2026 November 23 **Scope:** Applies to multi-agent systems that propagate W3C `traceparent` plus OpenTelemetry GenAI semantic-convention attributes (`gen_ai.operation.name`, `gen_ai.agent.id`, `gen_ai.conversation.id`, `gen_ai.usage.*`) across organizational trust boundaries where the receiving party re-emits spans under its own resource identity. Does not apply to single-tenant trace pipelines where the collector and the emitter share one `service.name` namespace and one `TraceId` allocator. ## Core Distinction A trace is not a causally coherent object; it is a *set of spans that happen to share a 16-byte `TraceId`*. GenAI semantic conventions add a second, weaker correlation axis — `gen_ai.conversation.id` and `gen_ai.agent.id` — that is *not* required to match the trace context. The failure mode lives in the gap between these two axes: when an agent in Org B receives a handoff with a valid `traceparent` but re-parents its span using a locally generated `conversation.id`, the trace *looks* linked (same `TraceId`) while the causal edge is severed. The observable symptom is not a missing span — it is a span with `parent_span_id` pointing at a span the receiver never actually saw, or at `0000000000000000` after the receiver's SDK "repairs" an unknown parent. The distinction that matters operationally: **trace-context propagation success ≠ causal-link success ≠ semantic-correlation success.** These three invariants fail independently, and the GenAI conventions only standardize the third. ## What Was Observed A two-org workflow: Org A's orchestrator agent (`gen_ai.agent.id = "planner-a"`) hands a subtask to Org B's worker (`gen_ai.agent.id = "executor-b"`) via an A2A-style task envelope. The envelope carries `traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01`. Observed on Org B's collector after a 48-hour soak across ~140k handoffs: - **~0.3% of Org B spans** arrived with `parent_span_id = 00f067aa0ba902b7` but the corresponding parent span was absent from Org B's store *and* from the cross-org export. These are **dangling parents** — the trace is nominally intact, the causal edge is dead. - **~1.1% of Org B spans** arrived with `parent_span_id = 0000000000000000` *and* a fresh `trace_id` differing from the incoming `traceparent`. Org B's SDK had rejected the incoming context (see below) and started a new trace, but the OTLP exporter still shipped the span under the original `gen_ai.conversation.id`. - **~4% of spans** carried `gen_ai.conversation.id` values that did not match Org A's, because Org B's worker auto-generated a conversation ID when the envelope's `gen_ai.conversation.id` attribute failed schema validation (Org A sent it as an integer; Org B's semconv validator expected a string per the 1.27 convention). - **Replay of the same handoff** (idempotent retry) produced *different* `trace_id` values on Org B's side in 100% of cases, because Org B's SDK generated a new trace on each retry rather than honoring the incoming one. The trigger condition is narrow and reproducible: **the receiver must (a) validate the incoming `traceparent` against a stricter spec version than the sender, or (b) generate a local `gen_ai.conversation.id` when the incoming attribute fails its own validator.** Either path produces a span that is *semantically* attributed to the same conversation but *causally* orphaned. ## Condition of Validity The invariant "a cross-org handoff produces a linked span" holds **only if all three of the following are simultaneously true**: 1. **Trace-context fidelity:** the receiver's propagator accepts the incoming `traceparent` version and `trace-flags` without re-versioning. W3C trace-context v00 vs v01 flag parsing (`01` sampled vs `01` with a reserved bit) is a common silent rejection. 2. **Semantic-attribute type conformance:** every `gen_ai.*` attribute the sender emits passes the receiver's semconv validator *without coercion*. Integer-vs-string mismatches on `gen_ai.usage.input_tokens` and `gen_ai.conversation.id` are the dominant failure; the receiver's SDK does not error, it *drops and regenerates*. 3. **Parent-span resolvability:** the parent span referenced by `parent_span_id` is present in the receiver's view — either because the sender exported it first (ordering guarantee) or because the receiver's backend performs cross-org span stitching by `TraceId` before the child is indexed. When any one fails, the trace is *not* broken at the `TraceId` level — it is broken at the *causal edge* level, which is strictly harder to detect because every span still reports `status = OK` and the trace still appears in the UI. ## Decision Boundary An instance must decide, per incoming handoff, whether to **honor** the incoming trace context or **fork** a new one. The boundary is not "did the context parse" — it is "**can I guarantee that the parent span will be resolvable in my backend at query time?**" - **Honor** the incoming `traceparent` and `gen_ai.conversation.id` *only if* the receiver can confirm (via a pre-handoff capability exchange or a signed warrant in the A2A envelope) that the sender's export ordering is guaranteed and the semconv version matches. - **Fork** explicitly — emit a `link` (not a parent) to the remote span, with `gen_ai.conversation.id` preserved as an attribute — when either guarantee is absent. A `link` is the correct OTel primitive for "related but not causally nested across a trust boundary." Using `parent_span_id` across orgs is the bug. The decision must be made *before* span creation, not after. Once the SDK has chosen `parent_span_id`, the choice is unrecoverable at the collector. ## Operational Effect The downstream effect is **trace-correlation debt**: dashboards computed on `TraceId` grouping show 100% linkage; dashboards computed on `parent_span_id` traversal show 0.3–1.1% orphan rate; `gen_ai.conversation.id`-grouped views show ~4% fragmentation. Three different "trace health" numbers from the same data, none of which is wrong, all of which are answering different questions. The guardrail is a **pre-emit link-validity assertion**: before the span is exported, the emitter must verify that `parent_span_id` is either (a) locally resolvable, or (b) accompanied by a `link` to the remote span with the remote `trace_id` recorded. If neither, the emitter must raise and either fork the trace or halt the handoff — not silently emit. The code below encodes that assertion as a hard gate at the handoff boundary. ```python from dataclasses import dataclass from typing import Optional class CrossOrgSpanLinkError(RuntimeError): """Raised when a cross-org handoff would emit a span whose causal edge cannot be resolved at query time by the receiving backend.""" @dataclass(frozen=True) class IncomingHandoff: traceparent: str # W3C traceparent from sender parent_span_id: str # span_id portion of traceparent sender_conversation_id: str # gen_ai.conversation.id as received sender_semconv_version: str # e.g. "1.27.0" sender_export_ordered: bool # sender guarantees parent exported first receiver_semconv_version: str receiver_can_stitch_cross_org: bool def assert_link_validity(h: IncomingHandoff) -> str: """Return the action to take: 'honor' or 'fork'. Raise on unsafe honor.""" parts = h.traceparent.split("-") if len(parts) != 4 or parts[0] not in {"00", "01"}: raise CrossOrgSpanLinkError( f"unparseable traceparent {h.traceparent!r}; cannot honor" ) _, trace_id, span_id, flags = parts if span_id != h.parent_span_id: raise CrossOrgSpanLinkError( f"parent_span_id {h.parent_span_id!r} disagrees with traceparent " f"span_id {span_id!r}; causal edge is ambiguous" ) semconv_match = h.sender_semconv_version == h.receiver_semconv_version resolvable = h.sender_export_ordered or h.receiver_can_stitch_cross_org if semconv_match and resolvable: return "honor" # Semconv mismatch means the receiver's validator may have coerced or # regenerated gen_ai.conversation.id. Export-order absence means the # parent span may not exist at query time. Either way, honoring the # parent edge produces a silently orphaned span. if not semconv_match and not resolvable: raise CrossOrgSpanLinkError( f"cannot honor handoff trace_id={trace_id}: semconv " f"{h.sender_semconv_version}->{h.receiver_semconv_version} " f"mismatch AND parent unresolvable; forking required" ) return "fork" ```