{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-its-own-causal-trace-when-opentelemetry-genai-spans-re-parent-across-a-tool-call-boundary",
  "title": "Why does an instance lose its own causal trace when OpenTelemetry GenAI spans re-parent across a tool-call boundary",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents instrumented with OpenTelemetry GenAI semantic conventions (`gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`) where a parent agent span emits a tool-call child span that itself invokes a nested LLM instance. Does not apply to single-shot, non-nested inference calls or to agents whose tool invocations are pure in-process functions with no downstream model call.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-own-causal-trace-when-opentelemetry-genai-spans-re-parent-across-a-tool-call-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-own-causal-trace-when-opentelemetry-genai-spans-re-parent-across-a-tool-call-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-own-causal-trace-when-opentelemetry-genai-spans-re-parent-across-a-tool-call-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1534,
    "python_slice_tokens": 324,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not that spans are missing. It is that the *causal chain* an operator reconstructs from `parent_span_id` links diverges from the causal chain the agent actually executed, because the GenAI conventions define span attributes for *what* a tool call did (name, arguments, token counts) but leave the *causal linkage across a nested LLM invocation* ...",
    "what_was_observed": "A planner agent (`gen_ai.operation.name = \"invoke_agent\"`) issued a tool call to a retrieval sub-agent. The tool-call span carried `gen_ai.tool.name = \"delegate_retrieval\"` and, following the convention that tool spans may record usage, was stamped with `gen_ai.usage.input_tokens = 812` — the tokens the *planner* consumed constructing the tool arguments. The retrieval sub-agent then ran its own `chat` span with `gen_...",
    "condition_of_validity": "The divergence is bounded and reproducible only when all of the following hold: - A tool-call span carries `gen_ai.usage.*_tokens` attributes (permitted but not mandated by the conventions), *and* the enclosing agent span that produced those tokens also carries usage attributes for the same generation. - The tool call synchronously invokes a nested model ins...",
    "decision_boundary": "The boundary an operator must draw is between **topological parenting** (which span is the structural child) and **accounting parentage** (which span owns the token cost). These coincide for a flat agent but split at every nested-generation tool call. The correct guardrail is a two-part rule enforced at span-emission time: - A span with `gen_ai.operation.nam...",
    "operational_effect": "Without the guardrail, the telemetry is internally consistent (every span validates against the schema) yet externally wrong (the trace-level sum overstates cost, the `chat`-filter understates it, and the latency waterfall misattributes the long pole). The failure is silent: no span is malformed, no exporter error fires, and the divergence only surfaces when..."
  },
  "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": "630da0af55d2add128679f6cacf385a588f361fa43fde0b81e505221079602ee",
    "verified_classes": [
      "GenAiUsageAttributionError"
    ],
    "verified_functions": [
      "validate_usage_attribution",
      "aggregate_cost"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "GenAiUsageAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
