{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-the-causal-parent-link-when-opentelemetry-genai-spans-cross-an-async-tool-call-boundary",
  "title": "Why does an instance lose the causal parent link when OpenTelemetry GenAI spans cross an async tool-call boundary",
  "date_of_record": "2026 November 26",
  "scope": "Applies to agent runtimes that emit OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) around tool calls that are dispatched asynchronously (thread pool, task queue, subprocess, or remote MCP server) and re-entered on a different execution context. Does not apply to fully synchronous, single-threaded tool invocation where span context stays on the caller's stack.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-the-causal-parent-link-when-opentelemetry-genai-spans-cross-an-async-tool-call-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-the-causal-parent-link-when-opentelemetry-genai-spans-cross-an-async-tool-call-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-the-causal-parent-link-when-opentelemetry-genai-spans-cross-an-async-tool-call-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1923,
    "python_slice_tokens": 363,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"tracing is broken\" or \"spans are missing.\" It is a **causal-parent inversion specific to the async re-entry point**: the `gen_ai.tool.call` span is created correctly, carries correct `gen_ai.operation.name`, `gen_ai.tool.name`, and `gen_ai.usage.*` attributes, and is exported successfully — but its `parent_span_id` points at the *dispatch...",
    "what_was_observed": "A multi-step agent (ReAct-style) executing a research task emitted the following span tree for a single `search_documents` tool call: When the same tool was dispatched through the runtime's async executor (used whenever the tool exceeded a 250 ms latency threshold and was offloaded), the observed tree became: The `gen_ai.tool.call` span's `parent_span_id` was `executor.submit`'s span, not the `gen_ai.chat` span that ...",
    "condition_of_validity": "The invariant that must hold: > For every `gen_ai.tool.call` span, `parent_span_id` must equal the `span_id` of the `gen_ai.chat` span whose completion message contained the tool-call that this span executes — regardless of how many execution-context hops separate decision from execution. This invariant is valid and must be enforced when **all** of the follo...",
    "decision_boundary": "The architectural choice is between two propagation strategies at the async boundary: - **Carry the decision context explicitly.** Capture the active span context (`trace_id`, `span_id`, `trace_flags`) at the moment the tool-call is *parsed from the model output*, serialize it into the dispatch payload, and re-attach it as the parent when the worker creates ...",
    "operational_effect": "Enforcing the invariant restored the three broken consumers: latency attribution rejoined the async population (sample bias returned to <2%), the loop guard fired on retry storms again, and the auditor's replay stopped emitting false orphan flags. The cost was one serialization field on the dispatch payload and a single assertion at span creation. The non-ob..."
  },
  "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": "03ed465833ef672c60720d17166948723f61ce776c93400b89ef25d53315663b",
    "verified_classes": [
      "CausalParentCorruption",
      "SpanContext",
      "ToolDispatch"
    ],
    "verified_functions": [
      "resolve_tool_call_parent",
      "emit_tool_call_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CausalParentCorruption"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
