{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-broken-agent-turn-span-chain-when-opentelemetry-genai-semantic-conventions-silently-drop-tool-call-parentage",
  "title": "How does an instance detect a broken agent-turn span chain when OpenTelemetry GenAI semantic conventions silently drop tool-call parentage",
  "date_of_record": "2026 November 23",
  "scope": "Applies to LLM agent runtimes that emit OpenTelemetry traces using the GenAI semantic conventions (`gen_ai.*` attributes) for multi-turn agent loops with tool invocation, where spans are exported asynchronously and parent/child linkage is reconstructed from `trace_id`/`span_id`/`parent_span_id`. Does not apply to single-shot inference calls without tool loops, nor to runtimes that emit a single flattened span per agent run.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-agent-turn-span-chain-when-opentelemetry-genai-semantic-conventions-silently-drop-tool-call-parentage.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-agent-turn-span-chain-when-opentelemetry-genai-semantic-conventions-silently-drop-tool-call-parentage.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-agent-turn-span-chain-when-opentelemetry-genai-semantic-conventions-silently-drop-tool-call-parentage.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1786,
    "python_slice_tokens": 391,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions model an agent turn as a *span tree*: an `invoke_agent` (or `chat`) span is the parent, and each `execute_tool` span is a child. The convention assumes that the parent-child edge is carried by the trace context (`parent_span_id`) and that the `gen_ai.tool.name`, `gen_ai.operation.name`, and `gen_ai.usage.*` attributes are suffi...",
    "what_was_observed": "A three-tool agent turn (turn index 4 of a session) produced the following exported span set, filtered by `trace_id`: Two of three tool spans (`cc03`, `ee05`) exported with `parent=<none>` despite being logically inside turn 4. `cc03` ran in a subprocess spawned by the tool executor; `ee05` ran on a thread-pool worker whose `contextvars` were not copied. `dd04` ran inline and correctly inherited `bb02`. The downstrea...",
    "condition_of_validity": "The attribute-based reconstruction is valid **if and only if** every span in the turn satisfies the parentage invariant at export time. The following conditions break it: 1. **Context non-inheritance across execution boundaries.** Any tool execution that crosses a process, thread-pool, or async-task boundary without explicit `contextvars.copy_context()` or `...",
    "decision_boundary": "The runtime must decide, per `execute_tool` span, whether to **emit with a verified parent** or **emit as a flagged orphan**. The boundary condition: - If the active OTel context contains a valid current span whose `gen_ai.operation.name` is `invoke_agent` or `chat` **and** whose `trace_id` matches the tool span's `trace_id`, emit normally. - If the active c...",
    "operational_effect": "With the emission-time assertion in place, the turn-4 case produces: The accounting job now excludes `parent_link=broken` spans from per-turn rollups and reports them as a separate *link-loss* metric. The 61% undercount becomes a visible 61% link-loss rate on turn 4, which is a fixable signal (patch the executor to propagate context) rather than a silent dat..."
  },
  "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": "c488b14cb14d973907aed9664c0a011a5f276cb5f00f0e3d1293f461feb8e5ea",
    "verified_classes": [
      "BrokenToolSpanParentage"
    ],
    "verified_functions": [
      "emit_tool_span",
      "rollup_per_turn"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "BrokenToolSpanParentage"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
