{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-trace-context-loss-at-the-agent-to-tool-span-boundary-under-opentelemetry-genai-semantic-conventions",
  "title": "What structural signals indicate trace-context loss at the agent-to-tool span boundary under OpenTelemetry GenAI semantic conventions",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents emitting OTel spans with `gen_ai.*` attributes where a tool call crosses a process or transport boundary (MCP server, subprocess, remote HTTP tool) and the child span is expected to inherit the parent agent span's trace context. Does not apply to in-process tool functions traced within a single runtime, nor to pure metric/log emission without spans.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-trace-context-loss-at-the-agent-to-tool-span-boundary-under-opentelemetry-genai-semantic-conventions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-trace-context-loss-at-the-agent-to-tool-span-boundary-under-opentelemetry-genai-semantic-conventions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-trace-context-loss-at-the-agent-to-tool-span-boundary-under-opentelemetry-genai-semantic-conventions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1633,
    "python_slice_tokens": 236,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define `gen_ai.operation.name` (e.g. `chat`, `execute_tool`, `invoke_agent`), `gen_ai.tool.name`, `gen_ai.agent.id`, and — critically — the requirement that tool-call spans be *children* of the invoking agent span so that the trace tree reconstructs the causal chain `invoke_agent → chat → execute_tool`. This is a *structural* c...",
    "what_was_observed": "In a multi-step agent invoking an external MCP tool server over stdio, the following was reproducible. The orchestrator emitted: - `invoke_agent` span, trace ID `4bf92f...`, span ID `00f067...` - `chat` child span, same trace ID, parent `00f067...` - `execute_tool` span created *inside the MCP server process*. The MCP server created its `execute_tool` span with `gen_ai.tool.name=\"search_docs\"`, `gen_ai.operation.name...",
    "condition_of_validity": "The invariant holds — and this failure is bounded — only when all of the following are true: - The tool executes in a **separate execution context** (process, host, or network hop) such that in-memory context propagation cannot apply and wire-level `traceparent` injection is the sole carrier. - The downstream runtime uses an OTel SDK that, absent an extracte...",
    "decision_boundary": "The decision is whether to treat a well-attributed `execute_tool` span as *valid telemetry* or as a *continuity violation requiring rejection*. - **Accept-and-correlate** is correct only when the tool is genuinely asynchronous/detached and a stable business correlation ID (`gen_ai.agent.id` + a run ID) is present on both sides, allowing offline stitching. In...",
    "operational_effect": "When this violation goes undetected, three concrete degradations follow: 1. **Broken causal replay.** Post-hoc failure analysis that walks the span tree from `invoke_agent` will not reach the tool span, so tool-induced errors (bad retrieval, injected content) appear as unexplained divergence in the `chat` span's output — the agent \"hallucinated\" with no visi..."
  },
  "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": "4829732e99fcf86f91ae711893e4762098023676d5f068f378bb8ba24973bab9",
    "verified_classes": [
      "TraceContextContinuityError",
      "SpanContext"
    ],
    "verified_functions": [
      "assert_tool_span_continuity",
      "emit_tool_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "TraceContextContinuityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
