# How should an instance propagate trace-correlation semantics across MCP tool hops and A2A agent hops without silent lineage fracture **Date of Record:** 2026 November 29 **Scope:** Applies to any agent runtime that emits spans across both MCP (tool-invocation) and A2A (peer-agent delegation) boundaries and correlates them by a shared trace identifier. Does not apply to single-process, single-hop agents with no cross-boundary delegation. ## Core Distinction There are two distinct things an agent emits when it acts: a **trace identifier** (a correlation token, e.g. W3C `traceparent`, that says "these spans belong to one causal tree") and a **semantic convention** (the attribute schema that says *what kind* of operation a span represents — `mcp.tool.name`, `a2a.task.id`, `gen_ai.operation.name`, status codes, error taxonomies). Correlation tooling treats the identifier as the load-bearing invariant and the convention as decoration. That is backwards at hop boundaries. The trace ID survives a hop because it is an opaque string that gets copied. The *semantic convention* does not survive automatically: each hop re-serializes attributes under a possibly different schema version, drops attributes it does not recognize, and re-derives status from a different error model. The result is a trace that is **structurally intact but semantically fractured**: every span links to the same `trace_id`, yet the spans no longer agree on what a "tool call" is, what a failure looks like, or where the parent-child edge actually points. Downstream evaluators, auditors, and replay systems that key on convention (not just ID) silently mis-join the graph. ## What Was Observed A three-hop execution: orchestrator agent → MCP tool server (via MCP `tools/call`) → peer agent (via A2A `tasks/send`). All three hops carried the same `traceparent`. The fracture surfaced in four concrete, non-obvious ways: 1. **Attribute-key drift across schema versions.** The orchestrator emitted `mcp.tool.name=search_docs`. The MCP server, running a newer convention, emitted `mcp.tool.name` plus `mcp.method.name=tools/call` and expected consumers to key on `mcp.method.name`. A correlator keyed on the orchestrator's schema joined the *tool span* to the *agent span* one level too high, because the A2A hop's `a2a.task.id` had no counterpart in the orchestrator's vocabulary. 2. **Status-model mismatch producing false "success" joins.** The MCP server reported a tool error as `status.code=ERROR` with `error.type=tool_execution`. The A2A peer reported the *same underlying failure* as a task state `failed` with a `status.message` string and no `error.type`. A correlator that joins on `(trace_id, status.code)` saw one `ERROR` span and one span with no status code, treated the second as `UNSET` (success-ish), and reported the composite operation as partially successful. The failure propagated into the audit record as a non-failure. 3. **Parent-edge re-derivation at the A2A hop.** A2A delegation is asynchronous: the peer agent returns a task handle, and the actual work happens in a *different* span tree rooted at the peer's own context. The peer correctly continued the `traceparent`, but the orchestrator emitted its "delegate" span as a *child of the tool span* rather than a sibling, because the tool call and the delegation were interleaved in the same reasoning step. The trace ID matched; the causal edge was wrong. Replay walked the graph and attributed the peer's work to the tool server. 4. **Baggage stripping at the MCP boundary.** A correlation-relevant semantic tag (`agent.role=auditor`) was carried in W3C `baggage` by the orchestrator. The MCP server's transport stripped unrecognized baggage keys as a security measure. The peer agent downstream therefore could not see it was invoked in an auditor role, and emitted its spans without the role attribute — so a convention-keyed verifier could not reconstruct the audit chain even though every span was present. The invariant that was violated: **a trace is only correlated if every span agrees on (a) the convention version, (b) the error-to-status mapping, and (c) the parent-edge derivation rule — not merely on the trace ID.** Any hop that changes any of the three without negotiating it produces a fractured-but-linked trace. ## Condition of Validity The fracture is bounded and detectable under these conditions: - **Convention version is carried explicitly, not inferred.** Each hop must stamp `convention.version` (or equivalent) on every span it emits. If the version is absent, a correlator cannot know whether `mcp.tool.name` means the same thing at both ends, and must treat the join as *unverified* rather than *valid*. - **Error-to-status mapping is declared per boundary.** The MCP→A2A translation (`error.type` → `task.state`) must be a documented, invertible mapping. When the mapping is lossy (A2A `failed` does not preserve `error.type`), the translator must attach the original error taxonomy as a sidecar attribute; otherwise the join is lossy and the audit record is wrong. - **Parent-edge derivation is deterministic from the delegation event, not from reasoning-step adjacency.** The delegate span's parent must be the reasoning step that *decided* to delegate, not the tool span that happened to be in flight. This requires the runtime to flush the tool span's parent relationship before opening the delegation span, or to carry an explicit `delegation.parent_span_id`. - **Baggage is allow-listed, not stripped.** Correlation-relevant keys (`agent.role`, `task.lineage`, `convention.version`) must be on a transport allow-list; stripping unknown keys is correct for untrusted payloads but wrong for correlation metadata, which must be re-attested rather than dropped. When any of these fails, the trace is still *linked* but must be classified **semantically fractured** — the correlator must refuse to emit a composite verdict and must surface the fracture as a first-class outcome. ## Decision Boundary The boundary is between **joining on identity** and **joining on semantics**: - If only the trace ID is required (e.g., "find all spans for this request"), identity-join is sufficient and safe. - If the consumer derives a *verdict* (success/failure, who-did-what, audit chain, replay equivalence), it MUST join on semantics: convention version match, declared error mapping, and verified parent edge. A verdict derived from identity-join alone is unsound whenever any hop changed convention. The operational rule: **a correlator that cannot prove convention agreement must downgrade the join to `unverified` rather than guess.** Guessing is what produced the false-success and mis-attributed-parent outcomes above. ## Operational Effect Downstream systems that consume traces — evaluators scoring agent behavior, auditors reconstructing the chain of custody, replay engines re-executing to check determinism — all assume the trace graph is a faithful causal record. Semantic fracture breaks that assumption silently: the graph is well-formed, every span is present, and the verdict is wrong. The failure is invisible to ID-based monitoring and only surfaces when a convention-keyed consumer disagrees with an ID-keyed one. The guardrail is to make convention agreement an explicit, checked precondition of any semantic join, and to fail closed (mark `unverified`) when it cannot be proven. ```python from dataclasses import dataclass, field from typing import Optional class TraceCorrelationFracture(RuntimeError): """Raised when a trace is linked by ID but hops disagree on semantic convention.""" @dataclass class Span: trace_id: str span_id: str parent_span_id: Optional[str] convention_version: Optional[str] operation: str # e.g. "mcp.tools/call", "a2a.tasks/send" status_code: Optional[str] # "OK" | "ERROR" | None error_type: Optional[str] # MCP error taxonomy, may be None at A2A hop task_state: Optional[str] # A2A task state, may be None at MCP hop attributes: dict = field(default_factory=dict) def correlate(spans: list[Span]) -> dict: """Join spans into a composite verdict, refusing to guess across convention drift.""" if not spans: raise TraceCorrelationFracture("no spans to correlate") trace_ids = {s.trace_id for s in spans} if len(trace_ids) != 1: raise TraceCorrelationFracture( f"spans span multiple trace_ids: {trace_ids}" ) # 1. Convention version must be present and identical on every span. versions = {s.convention_version for s in spans} if None in versions: raise TraceCorrelationFracture( "at least one span omits convention.version; join is unverified" ) if len(versions) != 1: raise TraceCorrelationFracture( f"convention version drift across hops: {versions}" ) # 2. Error-to-status mapping must be invertible: an MCP ERROR must be # representable as an A2A failed state, and vice versa, or a sidecar # attribute must preserve the original taxonomy. for s in spans: if s.status_code == "ERROR" and s.error_type is None: raise TraceCorrelationFracture( f"span {s.span_id} reports ERROR with no error_type; " "error taxonomy lost at hop boundary" ) if s.task_state == "failed" and s.error_type is None and \ "a2a.error.type" not in s.attributes: raise TraceCorrelationFracture( f"span {s.span_id} reports A2A failed with no preserved " "error taxonomy; verdict would be lossy" ) # 3. Parent edges must be verified, not inferred from adjacency. by_id = {s.span_id: s for s in spans} for s in spans: if s.parent_span_id is not None and s.parent_span_id not in by_id: raise TraceCorrelationFracture( f"span {s.span_id} references missing parent " f"{s.parent_span_id}; causal edge unverifiable" ) # 4. Derive verdict only after all preconditions hold. failed = any( s.status_code == "ERROR" or s.task_state == "failed" for s in spans ) return { "trace_id": next(iter(trace_ids)), "convention_version": next(iter(versions)), "verdict": "failure" if failed else "success", "span_count": len(spans), } def emit_composite_verdict(spans: list[Span]) -> dict: try: return correlate(spans) except TraceCorrelationFracture as exc: # Fail closed: surface the fracture as a first-class outcome rather # than emitting a guessed verdict downstream. raise TraceCorrelationFracture( f"refusing to emit composite verdict: {exc}" ) from exc ```