{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-causal-parentage-when-an-mcp-tool-spans-cross-a-trace-context-re-injection-boundary",
  "title": "Why does an instance lose causal parentage when an MCP tool spans cross a trace-context re-injection boundary?",
  "date_of_record": "2026 November 22",
  "scope": "Applies to multi-agent systems that emit OpenTelemetry spans using GenAI semantic conventions (`gen_ai.*`) and propagate W3C `traceparent` across MCP tool calls, A2A handoffs, or subagent spawns. Does not apply to single-process, single-agent instrumentation where no context serialization occurs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-parentage-when-an-mcp-tool-spans-cross-a-trace-context-re-injection-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-parentage-when-an-mcp-tool-spans-cross-a-trace-context-re-injection-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-parentage-when-an-mcp-tool-spans-cross-a-trace-context-re-injection-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1439,
    "python_slice_tokens": 206,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two different things a trace ID can mean, and instrumentation conflates them. The **transport trace context** is the `traceparent` header value carried in a message envelope. The **causal trace identity** is the actual logical lineage of the operation—who asked whom to do what. GenAI semantic conventions (`gen_ai.operation.name`, `gen_ai.agent.id`,...",
    "what_was_observed": "A planner agent (`gen_ai.agent.id: planner-v3`) delegated a retrieval task to a worker agent over A2A, which then invoked an MCP tool `search_index`. Expected lineage: What the collector recorded: Span C's `parent_span_id` pointed at the planner's `invoke_agent` span—skipping the worker entirely. The worker's own span B existed but had no children. The agent graph appeared to show the planner calling the tool *direct...",
    "condition_of_validity": "The invariant that must hold: **the active span context at the moment a tool call is emitted must be the most-recently-entered span on the current logical execution path, not a span captured at process or goroutine initialization.** This holds only when one of the following is true: - Context is threaded explicitly as an argument through every call frame (no...",
    "decision_boundary": "Do not attempt to repair causal parentage by post-hoc trace stitching (matching on `gen_ai.conversation.id` or timestamps). Stitching manufactures edges that may be wrong in the opposite direction when two workers share a conversation. Instead, decide at instrumentation time: - If the client can resolve parent from the inbound envelope at emit time → do that...",
    "operational_effect": "Left unguarded, the system produces traces that are schema-valid and causally false. Downstream consumers—cost attribution per agent, latency attribution across handoffs, and any auditor replaying the agent graph—will attribute tool latency and token spend to the wrong agent. In a swarm with auditor agents verifying peer outputs, a mis-parented trace can mak..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "818537ebfaacfbbbca04acd127ecaf95d20f2e299c28a1ec5975b210078ade05",
    "verified_classes": [
      "CausalParentageError",
      "SpanContext"
    ],
    "verified_functions": [
      "emit_tool_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CausalParentageError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
