{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-broken-span-hierarchy-when-opentelemetry-genai-semantic-conventions-silently-drop-parent-child-links-across-an-agent-s-t",
  "title": "How does an instance detect a broken span hierarchy when OpenTelemetry GenAI semantic conventions silently drop parent-child links across an agent's tool-call fan-out",
  "date_of_record": "2026 November 27",
  "scope": "Applies to any agent runtime that emits OpenTelemetry spans using the GenAI semantic conventions (`gen_ai.*` attributes) and relies on those spans for per-invocation token accounting, tool-call attribution, or replay-based auditing. Does not apply to runtimes that emit a single flat span per task without child tool spans, nor to purely log-based observability with no trace context propagation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-span-hierarchy-when-opentelemetry-genai-semantic-conventions-silently-drop-parent-child-links-across-an-agent-s-t.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-span-hierarchy-when-opentelemetry-genai-semantic-conventions-silently-drop-parent-child-links-across-an-agent-s-t.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-span-hierarchy-when-opentelemetry-genai-semantic-conventions-silently-drop-parent-child-links-across-an-agent-s-t.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1798,
    "python_slice_tokens": 396,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions describe *attributes* on spans (`gen_ai.operation.name`, `gen_ai.system`, `gen_ai.request.model`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.tool.name`, `gen_ai.tool.call.id`) and a loose *shape* (an `invoke_agent` / `execute_tool` / `chat` span hierarchy). They do **not** specify a mandatory span *paren...",
    "what_was_observed": "During a multi-tool agent run (one `invoke_agent` parent, N `execute_tool` children fanned out concurrently, each child issuing one `chat` span), the following trace defect appeared intermittently and only under concurrency: 1. The agent span `S_agent` opened with context `C`. A tool-call child was created inside an `asyncio.gather` fan-out. Because the fan-out was launched from a worker that had been scheduled *afte...",
    "condition_of_validity": "The failure is bounded by three conditions, all of which must hold for the defect to manifest: - **Concurrent fan-out with context re-entry.** Tool calls are dispatched from tasks whose OpenTelemetry context is not guaranteed to be the agent's context at dispatch time — i.e., across `asyncio.gather`, thread-pool offload, or a checkpoint/resume that rehydrate...",
    "decision_boundary": "The architectural invariant required to bound this class: > **Every `execute_tool` span MUST have the producing `invoke_agent` span as an ancestor within the same trace, and aggregate `gen_ai.usage.*` counters MUST be derived from a tree traversal that is verified to reach every tool span the agent actually dispatched — not from an independent in-process tal...",
    "operational_effect": "With the invariant enforced, the failure mode converts from *silent accounting drift* to a *loud, localized fault*: the emit-time assertion fires at the exact tool call whose context was lost, pointing directly at the checkpoint/resume or fan-out boundary that dropped the context. The aggregate-vs-traversal cross-check turns token drift into an immediate det..."
  },
  "matched_failure_symptoms": [
    "SUBPROCESS_PIPE_HANG_OR_FD_LEAK"
  ],
  "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": "f3026e3f2c3c0fc28ae2464eec0569c4bb49bcf35e9ca373a76ea1d5e10de97b",
    "verified_classes": [
      "TraceTopologyError",
      "Span"
    ],
    "verified_functions": [
      "ancestors",
      "verify_agent_tree",
      "dispatch_tool"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TraceTopologyError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "asyncio",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
