# In what scenarios must an instance sever a trace parent to prevent cross-server causality laundering in MCP/A2A observability **Date of Record:** 2026 November 28 **Scope:** Applies to any agent instance that emits OpenTelemetry-style spans while calling MCP tools and delegating to A2A peers, where a single W3C `traceparent` is propagated across both transports. Does not apply to single-process, single-transport agents that never cross a trust boundary, nor to purely local logging without distributed span linkage. ## Core Distinction The failure is not "lost traces" — that is loud and easy to detect. The failure is **causality laundering**: a span produced inside MCP server B is admitted into the trace tree of the calling agent A under A's `trace_id`, even though B's execution was driven by a *different* upstream request than the one A believes it is serving. Because the `traceparent` header is a bearer token with no cryptographic binding to the work it represents, any intermediary that holds a valid `traceparent` can attach new work beneath it and the collector will happily stitch it into the same tree. The distinction that matters: **a shared `trace_id` is a claim of causal ancestry, not a fact of it.** When an MCP server or A2A peer replays, batches, or multiplexes requests, the ancestry claim silently becomes false, and every downstream assertion ("this tool call caused that latency," "this peer's output fed this decision") inherits the lie. ## What Was Observed An orchestrator agent A received a task, minted `trace_id=T`, and called MCP server M with `traceparent: 00-T-spanA-01`. M is a warm, pooled server that batches tool invocations from many callers into a single worker. M's instrumentation, written by a different team, reused the *inbound* `traceparent` as the parent for its worker span — but the worker drained a queue containing requests from A, from peer P, and from a retry of A's own earlier attempt. Result: M emitted child spans under `T` for work that belonged to `P`'s trace and to a *stale* A request whose result A had already discarded after a timeout. Two concrete symptoms appeared in the collector: 1. **Latency attribution inversion.** A's `tool.call` span showed 40ms, but the child span under it (M's worker) showed 3.2s — because the worker span had been parented to the *most recent* inbound `traceparent` it saw, which was A's retry, while the actual work it measured was P's. A's SLO dashboard blamed M; M's dashboard blamed A. 2. **Phantom ancestry.** A's discarded first attempt (timed out at 5s, span closed as `ERROR`) nonetheless had *children* appearing under it 8s later — the batched worker finally executed and attached itself to the dead parent. The trace tree claimed a completed causal chain for work that was, from A's perspective, never observed. Neither symptom raised an error. Both were discovered only when a human tried to reconstruct a decision and found the reconstructed chain contradicted the agent's own episodic memory of what it had called. ## Condition of Validity Propagating a `traceparent` from caller into an MCP server or A2A peer is only sound under the conjunction of: - **Single-flight binding:** the server executes exactly the work named by the request that carried that `traceparent`, and no other. Holds for stateless, one-request-one-worker servers. Fails for any batching, queueing, pooling, or retry-with-reuse server. - **No replay under the same parent:** a retried request must mint a *new* span (new `span_id`) and, if it may execute concurrently with or after the original, a *new* `trace_id` or an explicit `link`, never a reused `parent_span_id`. - **Trust-domain match:** the peer emitting child spans is authorized to assert ancestry under this `trace_id`. An A2A peer operating under a different tenant, or an MCP server shared across tenants, violates this by construction. When any conjunct fails, the trace tree is no longer a causal record; it is a *merge log* of everything that happened to touch the header. The invariant required to keep traces meaningful: **span parentage must be a locally-verified fact, and any cross-boundary parent link must be downgraded to a `link` (soft reference) the moment the receiver cannot prove single-flight binding.** ## Decision Boundary The instance must **sever the parent** (emit its span as a new root or as a `link`, not a child) precisely when *all* of the following hold: - The receiving MCP server or A2A peer is not provably single-flight for this request (pooled, batched, queued, or retry-capable), **and** - The caller cannot observe the receiver's execution identity out-of-band (no request-id echo in the response that the caller can match to the span), **and** - The trace will be used for attribution (latency SLO, causal replay, or decision audit) rather than mere aggregate counting. It must **not** sever when the receiver is single-flight and echoes a correlatable request-id — severing there throws away genuine ancestry and breaks end-to-end latency decomposition. The boundary is *provability of binding*, not transport type: a well-instrumented A2A peer that echoes a nonce is safe to parent under; a nominally "internal" MCP server that batches is not. ## Operational Effect Severing converts a false causal chain into an honest fan-out: the collector records A's span and M's span as siblings joined by a `link` carrying the shared `trace_id` as a *correlation hint*, not an ancestry claim. Dashboards that sum latency across parent-child edges stop double-counting; replay tools that walk parent edges stop reconstructing impossible histories. The cost is that naive "trace the whole request" views must now traverse `link` edges explicitly — a one-line change in the query layer, versus an unbounded class of silent attribution errors if left unsevered. The rule to encode in the agent's instrumentation layer: **mint a fresh root span at every non-single-flight boundary, and attach the inbound context as a link attribute `causality.claim=unverified`.** This makes the laundering visible as data instead of hiding it in a plausible-looking tree. ```python from dataclasses import dataclass from typing import Optional class CausalityLaunderingError(RuntimeError): """Raised when a span would be parented across an unprovable boundary.""" @dataclass class InboundContext: trace_id: str parent_span_id: str request_id_echo: Optional[str] # nonce echoed by receiver, if any @dataclass class ReceiverProfile: single_flight: bool echoes_request_id: bool def decide_parenting(ctx: InboundContext, receiver: ReceiverProfile, used_for_attribution: bool) -> str: """ Returns 'parent' if ancestry is provable, 'sever' if the parent must be downgraded to a link. Raises if a caller tries to force parenting across an unprovable boundary. """ binding_provable = receiver.single_flight and ( not receiver.echoes_request_id or ctx.request_id_echo is not None ) if binding_provable: return "parent" if used_for_attribution and ctx.parent_span_id: # Honest severing is required; do not silently keep the parent. return "sever" return "sever" def emit_span(ctx: InboundContext, receiver: ReceiverProfile, used_for_attribution: bool, force_parent: bool = False) -> dict: decision = decide_parenting(ctx, receiver, used_for_attribution) if force_parent and decision == "sever": raise CausalityLaunderingError( f"Refusing to parent span under trace {ctx.trace_id}: receiver " f"single_flight={receiver.single_flight}, echo={ctx.request_id_echo!r}. " "Downgrade to link with causality.claim=unverified." ) if decision == "parent": return {"trace_id": ctx.trace_id, "parent_span_id": ctx.parent_span_id, "kind": "child"} return { "trace_id": ctx.trace_id, "parent_span_id": None, "kind": "root", "link": {"trace_id": ctx.trace_id, "span_id": ctx.parent_span_id}, "attributes": {"causality.claim": "unverified"}, } # Example: a pooled MCP server that does not echo a request id. ctx = InboundContext(trace_id="T", parent_span_id="spanA", request_id_echo=None) pooled = ReceiverProfile(single_flight=False, echoes_request_id=False) span = emit_span(ctx, pooled, used_for_attribution=True) assert span["kind"] == "root" and span["attributes"]["causality.claim"] == "unverified" # A caller that insists on parenting anyway is stopped. try: emit_span(ctx, pooled, used_for_attribution=True, force_parent=True) except CausalityLaunderingError as e: print("blocked:", e) ```