# Where must an instance carry its own correlation identity when A2A hop boundaries sever the MCP span tree **Date of Record:** 2026 November 25 **Scope:** Applies to observability pipelines that reconstruct a single causal trace across agent-to-agent (A2A) handoffs and MCP tool invocations, where the downstream agent or MCP server runs in a separate process, trust domain, or vendor boundary. Does not apply to single-process agents whose spans all share one in-memory tracer/context. ## Core Distinction The failure is not "missing trace context." It is the distinction between *propagated* correlation identity and *regenerated* correlation identity at a trust or process boundary. A span exporter that can see a W3C `traceparent` header will happily continue a trace across an A2A hop. But an MCP tool call is frequently initiated by a *new* client session whose transport (stdio, SSE, or a vendor-managed streamable HTTP endpoint) does not forward arbitrary inbound headers, and whose server runtime constructs its own root span. The result is a trace that is *structurally valid at every hop* and *causally broken across the hop*: two disjoint trace trees, each internally consistent, joined only by a wall-clock timestamp that the correlator must guess at. The invariant that breaks: **a trace's parent-child edges must be derived from carried identity, not inferred from temporal proximity.** When a boundary strips carried identity, any pipeline that falls back to time-window inference will produce false joins under load and false splits under backpressure—and it will do so silently. ## What Was Observed A three-stage pipeline: an orchestrator agent (`A`) invokes a retrieval agent (`B`) over A2A, and `B` calls an MCP tool `search_index` on server `S`. All three emit OpenTelemetry spans to a collector. Under nominal load the pipeline reconstructed a single trace with ~99% join rate. Under a synthetic load test (A2A hop latency inflated to 400–900 ms, MCP server p99 at 1.2 s), the join rate for the `A→B→S` chain collapsed to ~61%, while *individual* span validity stayed at 100%. The mechanism, isolated by replaying captured payloads: 1. `A` emits `span(A)` with `trace_id=T`, `span_id=a1`, and injects `traceparent: 00-T-a1-01` into the A2A request body (not headers—the A2A transport used a JSON envelope). 2. `B`'s A2A handler reads the envelope, extracts `traceparent`, and correctly parents `span(B)` as a child of `a1` under `T`. So far correct. 3. `B` then opens an MCP client session to `S`. The MCP client library used did **not** support arbitrary header injection on `initialize`; it forwarded only the protocol-mandated fields. `S` therefore had no `traceparent`, generated a fresh `trace_id=T'`, and emitted `span(S)` as a root under `T'`. 4. The collector received `span(B)` (trace `T`) and `span(S)` (trace `T'`) with no parent edge. The correlator's fallback heuristic—"if a root span's `start_time` falls within ±500 ms of a leaf span's `end_time`, join them"—then fired. Two distinct pathologies followed from that heuristic: - **False join under load:** because `B`'s outbound MCP call was slow (p99 1.2 s), `span(S)`'s `start_time` drifted *outside* the ±500 ms window from `span(B)`'s `end_time` in ~30% of cases. The correlator split a chain that was in fact causal, producing orphaned `S` spans attributed to no agent. Dashboards undercounted tool latency by attributing it to "unattributed." - **False join across concurrent requests:** when `B` handled two concurrent A2A requests (`r1`, `r2`) and each spawned an MCP call, the ±500 ms window occasionally straddled both. The correlator attached `span(S_r2)` to `span(B_r1)`. This is a *misattribution*, not a split: the trace looks complete, the latency numbers are wrong, and no error is raised. In the load test, ~4% of joined chains had at least one cross-request edge. The critical observation: **no component logged an error.** `A`, `B`, and `S` each behaved correctly within their own contract. The corruption lived entirely in the correlator's inference layer, and it was invisible because the output was *plausible*. ## Condition of Validity The time-window fallback is only sound when all of the following hold, and in practice at least one fails at every real boundary: 1. **Clock sync bounded below the window.** The ±500 ms window assumes `start_time`/`end_time` across hosts are comparable to better than 500 ms. Under NTP skew or container clock drift at a boundary, this is unguaranteed. The window must be derived from measured skew, not chosen as a constant. 2. **No concurrent sibling requests within the window.** The false-join pathology requires that at most one in-flight request can plausibly own any given root span. Any agent serving concurrent traffic violates this by construction. 3. **Latency p99 below the window.** The false-split pathology requires that hop latency never exceed the window. A 1.2 s MCP p99 against a 500 ms window violates this directly. The window and the latency distribution are in a race, and load wins. 4. **Boundary does not strip identity.** If the MCP transport could carry `traceparent`, the fallback would never be consulted. The fallback exists only because the primary path is unavailable—so it is *always* operating in the degraded regime. The invariant to enforce: **a span is joinable to its causal parent only via carried identity (trace_id/parent_span_id or an explicit, signed correlation token). Temporal inference is admissible only as an annotation (`inferred_parent=true`, with a confidence and the skew budget), never as a silent edge.** ## Decision Boundary The boundary that determines the correct architecture is whether the instance at the hop **controls its outbound transport metadata**. - **If the A2A/MCP transport supports header or envelope injection** (most A2A JSON envelopes do; some MCP HTTP transports do): the instance MUST carry `traceparent` (or an equivalent signed correlation tuple `{trace_id, parent_span_id, origin_instance_id, warrant}`) in the envelope, and the receiving instance MUST reject the request if the token is absent *when the caller declared a traced context*. A missing token on a traced call is a contract violation, not a degradation to absorb. - **If the transport cannot carry metadata** (e.g., a vendor-managed MCP endpoint that only accepts protocol fields): the instance MUST mint a **correlation token**—an opaque, signed `{origin_instance_id, local_span_id, issued_at, nonce}`—embed it in a *tool argument* the server echoes back in its response or logs, and the correlator MUST join on token equality, not time. The server need not understand the token; it only needs to be unable to drop it. This is the non-obvious move: when the protocol won't carry your identity, smuggle it through the payload the protocol *must* preserve. The decision boundary is therefore not "does the boundary exist" (it always does) but "**can I make the boundary preserve an echo of my identity, and can I verify the echo?**" If yes, join on the echo. If no, the chain is *unjoinable* and must be reported as such—an explicit `broken_chain` marker—rather than repaired by inference. ## Operational Effect Enforcing carried-identity-or-explicit-break changes three things: 1. **Join rate becomes a reported metric, not a hidden assumption.** The pipeline emits `chain_join_status ∈ {carried, token_echo, broken}` per chain. A drop in `carried`/`token_echo` is an alertable regression in transport instrumentation, not a silent data-quality decay. 2. **Misattribution is eliminated at the cost of admitted gaps.** The ~4% cross-request false joins in the load test became explicit `broken` chains. Dashboards show *fewer* complete traces but *correct* ones; tool latency attribution moves from "unattributed" to "broken_chain: MCP transport lacks header injection," which is actionable. 3. **The correlator's time-window heuristic is demoted to annotation.** It may still annotate a `broken` chain with a *candidate* parent and a skew-budget confidence, but it cannot emit a parent edge. Replay of the load test confirmed zero silent cross-request edges after this change. The residual cost: chains through metadata-stripping MCP servers remain `broken` until either the transport is upgraded or the tool-argument echo path is instrumented. That is a *known, bounded* gap—which is the entire point. An observability pipeline that cannot distinguish "no causal link" from "causal link I couldn't see" is not observing; it is inventing. ```python from dataclasses import dataclass from typing import Optional class CorrelationInvariantError(RuntimeError): """Raised when a span is about to be joined without carried identity.""" pass @dataclass(frozen=True) class SpanRef: trace_id: str span_id: str origin_instance: str start_ns: int end_ns: int correlation_token: Optional[str] = None # echoed through tool args when headers unavailable def join_span(child: SpanRef, candidate_parent: SpanRef, skew_budget_ns: int, allow_inference: bool = False) -> str: """ Returns the join status. Refuses to emit a silent parent edge. """ # Primary path: carried identity (trace_id + explicit token or parent pointer). if child.trace_id == candidate_parent.trace_id: return "carried" if child.correlation_token and child.correlation_token == candidate_parent.correlation_token: return "token_echo" # No carried identity. Temporal inference is annotation-only. gap = abs(child.start_ns - candidate_parent.end_ns) if gap <= skew_budget_ns and allow_inference: # Annotate, never edge. return f"inferred_candidate(confidence={1.0 - gap / skew_budget_ns:.2f})" if child.correlation_token is None and child.trace_id != candidate_parent.trace_id: # The boundary stripped identity and no echo token was smuggled through. raise CorrelationInvariantError( f"cannot join span {child.span_id} (trace {child.trace_id}) to " f"{candidate_parent.span_id} (trace {candidate_parent.trace_id}): " f"no carried identity and no correlation token; " f"temporal gap {gap}ns vs budget {skew_budget_ns}ns. " f"Report as broken_chain, do not infer." ) return "broken_chain" ```