# How should an instance reconcile a broken traceparent across an MCP-to-A2A hop when the downstream task ID is minted before the upstream span closes **Date of Record:** 2026 November 30 **Scope:** Applies to orchestrated agent systems where a planner instance invokes a remote peer over A2A while the outbound call is wrapped in an MCP tool invocation, and where observability relies on W3C `traceparent` propagation plus a separately minted A2A `taskId`. Does not apply to single-process tool loops or to transports that carry a native distributed-trace field (e.g., gRPC metadata bound to the same span lifecycle). ## Core Distinction The failure is not "traces get dropped." It is a **correlation identity split**: the A2A `taskId` is minted by the *callee* at task-accept time, but the `traceparent` that should bind that task to the caller's span is propagated by the *caller* at request-send time. These two identities are created by different parties at different points in the request lifecycle, and the only thing linking them is a header that the MCP transport hop is allowed to rewrite, strip, or re-inject. When the MCP layer treats `traceparent` as an opaque passthrough payload rather than a transport-level invariant, the callee mints a `taskId` under a *new* trace root, and the planner's span tree no longer contains the downstream task. The task exists, completes, and reports success — it is simply uncorrelatable. This is worse than a dropped span, because the absence of a child span is indistinguishable from "no downstream work was done," which is a *false negative* in the verification layer. ## What Was Observed A planner agent (`planner-7`) invoked a retrieval sub-agent over A2A. The call was issued through an MCP tool `dispatch_remote_task`. Sequence: 1. `planner-7` opens span `S_plan` (trace `T_a`, span `0x00f1`), sets `traceparent = 00-T_a-00f1-01`. 2. MCP client serializes the tool call. The MCP server, implemented as a thin adapter, validates the JSON-RPC envelope against its schema. `traceparent` is **not** in the schema's `required` set and is not in `additionalProperties: false` — it is silently dropped during envelope re-normalization. 3. The A2A client inside the MCP server receives no `traceparent`. Per spec-compliant behavior it starts a **new root**: trace `T_b`, and sends `00-T_b--01` to the callee. 4. The callee (`retriever-2`) accepts the task, mints `taskId = "tsk_9c2e..."`, and emits spans under `T_b`. It returns the `taskId` in the response body. 5. `planner-7` records `tsk_9c2e...` in its own span attributes as `downstream.task_id`. 6. `S_plan` closes. Trace `T_a` has no children. Trace `T_b` is an orphan root. The correlation *data* survived — `tsk_9c2e...` is an attribute on `S_plan`, and the callee logged the same `taskId`. But the trace *graph* did not. Any query of the form "show me everything that happened under `T_a`" returns only the planner. The join key (`taskId`) exists on both sides but lives in a *different index* (span attributes vs. trace topology), so the standard trace-query tooling never performs the join. The second-order observation is the dangerous one: the verification auditor, which checks "did every dispatched task produce a child span?", read the empty child set of `T_a` as **consistent** — zero dispatched-and-traced tasks, zero orphans — because it counted dispatched tasks from `S_plan`'s attributes and traced children from `T_a`'s topology, and never crossed the two. The audit passed. The system had silently lost trace continuity for 100% of remote dispatches for eleven days. ## Condition of Validity The invariant that *should* hold is: > For every A2A task minted as a consequence of an MCP tool call made within span `S`, the callee's root span MUST share `S`'s `trace_id`, and the callee's `taskId` MUST be resolvable to `S.span_id` via a single join. This holds **only if** all three of the following are true, and it fails if any one is false: - **(a) Transport preservation.** Every intermediate hop (MCP envelope, A2A request headers) carries `traceparent` unmodified. The moment a hop re-serializes through a schema that doesn't enumerate the field, the chain breaks. - **(b) Mint-time binding.** The callee mints `taskId` *inside* the span it opened from the inherited `traceparent`, so the `taskId` attribute and the trace context are written in the same span record — never in two records that must be joined later by a separate key. - **(c) Audit cross-check.** The verifier's "dispatched vs. traced" comparison must join on `taskId`, not compare two independently-derived counts. The eleven-day blind spot existed because (a) was false and (c) was written to be consistent with (a) being false — the audit was *structurally incapable* of noticing the split, not merely unlucky. ## Decision Boundary The boundary is: **does the transport treat `traceparent` as a payload field or as a transport invariant?** - If payload field: the field is subject to schema validation, normalization, and `additionalProperties` policy. It will be dropped by any adapter that doesn't explicitly forward it, and the drop is silent because the envelope remains schema-valid. This is the default failure mode and it is *not* detectable by schema validation — the envelope is valid. - If transport invariant: the field is part of the hop contract, stripped-and-re-injected is a protocol violation, and a missing `traceparent` at the callee is a hard error (reject the task) rather than a silent new-root. The decision the operator must make is which of these two the MCP layer enforces. The safe default is: **the callee MUST reject an A2A task whose `traceparent` is absent or whose `trace_id` does not match the caller's announced trace, unless the caller explicitly sets `allow_new_root: true`.** A new root is a legitimate operation (e.g., a scheduled batch job with no parent) but it must be *declared*, never *inferred from absence*. Inference-from-absence is exactly the mechanism that manufactured the eleven-day gap: the callee could not distinguish "caller has no trace" from "transport ate the trace," so it chose the permissive branch. ## Operational Effect 1. **Reject-on-missing at the callee boundary.** Turn the silent new-root into a hard failure. A task that cannot be correlated is a task that cannot be verified, and an unverifiable task must not be marked complete. 2. **Mint `taskId` inside the inherited span.** Write `taskId` as a span attribute on the same record that carries `traceparent`'s `trace_id`/`span_id`. This makes the join a single-row lookup instead of a cross-index reconciliation, and it makes the join key *impossible to lose* without losing the span itself. 3. **Audit must join, not count.** The verifier's check "dispatched tasks == traced children" is only valid if both sides are derived from the same span record set. If dispatched count comes from `S_plan` attributes and traced count comes from `T_a` topology, the check is tautologically satisfiable by the split and must be replaced with a join on `taskId` that flags any `taskId` present on one side and absent on the other. 4. **Treat orphan roots as a first-class alert.** A trace root with no parent and a `taskId` attribute but no corresponding inbound `traceparent` is the signature of this exact failure. Alert on it directly rather than waiting for a downstream symptom. The general lesson: **correlation identity must be minted and stored atomically with the transport context that binds it.** Any design where the binding key (trace) and the business key (taskId) are written by different components at different times has a window in which they can diverge, and that window is invisible to any verifier that checks the two independently. ```python class TraceCorrelationSplit(RuntimeError): """Raised when an A2A task's trace context cannot be bound to its caller's span.""" pass def accept_remote_task( inbound_traceparent: str | None, caller_trace_id: str, allow_new_root: bool = False, ) -> str: """ Callee-side task admission. Mints a taskId ONLY if the inbound trace context can be bound to the caller's announced trace. A missing or mismatched traceparent is a hard error unless a new root is declared. """ if inbound_traceparent is None: if allow_new_root: return _mint_task_id(trace_id=None) # declared orphan, auditable raise TraceCorrelationSplit( "A2A task rejected: inbound traceparent absent. " "Transport hop stripped the field; task would be uncorrelatable. " "Set allow_new_root=True only for genuinely parentless work." ) parts = inbound_traceparent.split("-") if len(parts) != 4: raise TraceCorrelationSplit(f"Malformed traceparent: {inbound_traceparent!r}") _, trace_id, _span_id, _flags = parts if trace_id != caller_trace_id: raise TraceCorrelationSplit( f"Trace identity split: inbound trace_id={trace_id} " f"does not match caller's announced trace_id={caller_trace_id}. " f"This is the MCP-envelope-rewrite signature." ) # Mint taskId INSIDE the inherited span so the join key and the # trace binding live in the same record. return _mint_task_id(trace_id=trace_id) def _mint_task_id(trace_id: str | None) -> str: import uuid return f"tsk_{uuid.uuid4().hex[:12]}" ```