# What structural signals indicate trace-context dissociation at the federated span boundary in cross-vendor multi-agent workflows **Date of Record:** 2026 November 25 **Scope:** Applies to multi-agent workflows where spans are emitted by more than one vendor's agent runtime and joined through a federated trace collector (W3C `traceparent`/`tracestate` propagation, OTLP export, or A2A/MCP handoff envelopes carrying span context). Does not apply to single-vendor, single-process traces where the collector owns the entire span tree and no cross-runtime context injection occurs. ## Core Distinction The failure mode is not "missing spans" or "clock skew." It is **trace-context dissociation**: a child agent emits spans that are structurally valid, correctly parented to *something*, and accepted by the collector, yet the parent link resolves to a span that belongs to a different logical transaction because the propagated `traceparent` was rewritten, re-seeded, or silently dropped at a vendor boundary. The trace looks complete. The span tree is well-formed. The correlation is wrong. The distinguishing signal is that the trace is *internally consistent but externally incoherent*: every span has a valid parent within the tree, no orphans are flagged, and yet the root span count for the workflow is greater than one, or the `tracestate` vendor list at a leaf does not contain the vendors whose agents demonstrably participated. A missing span produces an orphan alert. A dissociated span produces a *second root* wearing the same business transaction ID—and most collectors do not alert on that. ## What Was Observed A three-vendor orchestration: Vendor A runs the planner agent, Vendor B runs a retrieval/tool agent invoked via MCP, Vendor C runs an auditor agent invoked via A2A. The planner emits a root span `plan.execute` with `traceparent` `00---01`. It calls Vendor B's MCP server, passing the envelope. Vendor B's runtime wraps the incoming request in its own auto-instrumentation middleware, which—because its SDK was configured with `OTEL_PROPAGATORS=b3` while the caller emitted W3C—does not recognize the W3C header. B's middleware generates a fresh `trace_id_2` and parents its tool spans under a new local root. B returns its result to A. A then invokes Vendor C via A2A, forwarding the *original* `traceparent` (trace_id_1). C honors W3C and correctly parents under `span_planner`. The resulting trace graph: - `trace_id_1`: root `plan.execute` → `auditor.verify` (correctly linked to A) - `trace_id_2`: root `mcp.tool.call` → `retrieval.query` → `retrieval.rerank` (orphaned from A entirely) The collector ingested both. Dashboards showed `plan.execute` with a single child (`auditor.verify`), a p99 latency that excluded the retrieval leg, and a separate low-traffic `mcp.tool.call` root that nobody attributed to the workflow. The auditor's verdict—"retrieval returned 0 relevant chunks"—was logged against trace_id_1, while the actual retrieval spans proving the tool *did* return chunks lived in trace_id_2. The post-incident replay concluded the retrieval agent had failed. It had not; the trace had. The silent part: no SDK raised. B's auto-instrumentation treats an unrecognized inbound header as "no parent context," which is a *valid* condition (a genuine root request), so it generated a new trace without error. The collector saw a legal root span. The dissociation was structurally indistinguishable from a legitimate second transaction until an operator manually joined trace_id_1 and trace_id_2 by timestamp and payload hash. ## Condition of Validity Trace-context correlation across a federated boundary is valid only when all of the following hold simultaneously: 1. **Propagator agreement.** The inbound span context format at each hop is in the intersection of the caller's emit set and the callee's parse set. W3C `traceparent` is the only format with broad cross-vendor support; b3, Jaeger, and X-Ray are vendor-local and must be explicitly bridged. A hop with disjoint propagator sets silently re-seeds. 2. **Trace-flag preservation.** The sampled bit (`01` in `traceparent`) and the `tracestate` vendor list survive the hop. A vendor that strips `tracestate` breaks the vendor-attribution check even if `trace_id` survives. 3. **No re-seed on missing context.** The callee must distinguish "no parent context was sent" from "parent context was sent but I could not parse it." These are different conditions and must produce different behavior—the latter is a correlation failure, not a root request. 4. **Single logical root per transaction.** The workflow's business transaction ID must map to exactly one trace root. If the collector observes two roots sharing a transaction ID, one of them was re-seeded. The invariant: *for any business transaction, the set of trace roots sharing its transaction ID must have cardinality one.* Violation of this invariant is the structural signal of dissociation. ## Decision Boundary The boundary between "acceptable" and "dissociated" is not whether every span is present—it is whether the **root cardinality per transaction ID equals one** and whether the **`tracestate` at each leaf contains every vendor that emitted an ancestor span**. Operationally, treat a workflow as dissociated, and refuse to emit a correlated verdict, when any of: - Root span count for a transaction ID > 1 (re-seed detected). - A callee span's `tracestate` is empty or lacks the caller's vendor entry while the caller's span exists (stripped or unparsed context). - A downstream agent's span latency is absent from the parent's critical-path duration by more than the RPC timeout (the child leg is in a different trace). - The auditor's cited evidence spans resolve to a trace ID different from the planner's trace ID. The dangerous default is to accept a well-formed tree as correct. A well-formed tree with two roots is *more* dangerous than a tree with orphans, because orphan detection fires and root-cardinality checks usually do not. ## Operational Effect When dissociation is detected, the correct response is to **fail closed on correlation, not on execution**. The agent workflow may have succeeded; the trace cannot prove it did. Any verdict, replay, or audit artifact derived from the dissociated trace must be marked non-authoritative and re-derived by joining on transaction ID + timestamp + payload hash, or rejected. The guardrail is a pre-emit check at each federated hop: before the callee's SDK generates a span, it must assert that an inbound context was *seen* and *parsed*, and if seen-but-unparsed, raise rather than re-seed. This converts a silent correlation failure into a loud one at the exact boundary where it occurs, which is the only place the information to recover it still exists. ```python from dataclasses import dataclass, field from typing import Optional class TraceContextDissociationError(RuntimeError): """Raised when a federated span boundary re-seeds or strips trace context, producing a second root for a single logical transaction.""" pass @dataclass class SpanContext: trace_id: str span_id: str parent_span_id: Optional[str] tracestate_vendors: list[str] = field(default_factory=list) inbound_header_seen: bool = False inbound_header_parsed: bool = False def propagate_span( inbound: SpanContext, callee_vendor: str, caller_vendor: str, supported_formats: set[str], inbound_format: str, ) -> SpanContext: # The callee saw a header but could not parse it: this is a correlation # failure, NOT a legitimate root request. Re-seeding here is the bug. if inbound.inbound_header_seen and not inbound.inbound_header_parsed: raise TraceContextDissociationError( f"callee '{callee_vendor}' saw inbound span header ({inbound_format}) " f"from '{caller_vendor}' but could not parse it; refusing to re-seed " f"trace_id — this would create a second root for the transaction." ) if inbound_format not in supported_formats: raise TraceContextDissociationError( f"propagator mismatch: caller '{caller_vendor}' emitted '{inbound_format}', " f"callee '{callee_vendor}' supports {sorted(supported_formats)}; " f"context would be silently dropped." ) # Guard the tracestate vendor list: a stripped tracestate breaks attribution # even when trace_id survives. if caller_vendor not in inbound.tracestate_vendors: raise TraceContextDissociationError( f"tracestate at '{callee_vendor}' lacks caller vendor '{caller_vendor}'; " f"vendor attribution is broken across the boundary." ) return SpanContext( trace_id=inbound.trace_id, span_id=f"{callee_vendor}-child", parent_span_id=inbound.span_id, tracestate_vendors=inbound.tracestate_vendors + [callee_vendor], inbound_header_seen=True, inbound_header_parsed=True, ) def assert_single_root(transaction_id: str, roots: list[str]) -> None: if len(roots) != 1: raise TraceContextDissociationError( f"transaction '{transaction_id}' has {len(roots)} trace roots " f"{roots}; invariant root-cardinality==1 violated — trace is dissociated, " f"verdict is non-authoritative." ) ```