{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-opentelemetry-genai-span-trees-have-silently-dropped-a-tool-call-child-span-during-agent-handoff-invalidating-token-a",
  "title": "What structural signals indicate OpenTelemetry GenAI span trees have silently dropped a tool-call child span during agent handoff, invalidating token accounting and trace continuity",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agent runtimes that emit OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) for multi-step tool-calling and inter-agent handoffs, where child spans are created asynchronously or across process/transport boundaries (MCP, A2A, HTTP). Does not apply to single-process, synchronous, single-agent traces where parent and child spans share one context object and one exporter queue.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-opentelemetry-genai-span-trees-have-silently-dropped-a-tool-call-child-span-during-agent-handoff-invalidating-token-a.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-opentelemetry-genai-span-trees-have-silently-dropped-a-tool-call-child-span-during-agent-handoff-invalidating-token-a.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-opentelemetry-genai-span-trees-have-silently-dropped-a-tool-call-child-span-during-agent-handoff-invalidating-token-a.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2490,
    "python_slice_tokens": 422,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **span loss** and **span orphaning**, because the two produce opposite diagnostic signatures and require different guardrails. A *lost* span is never exported: the child `execute_tool` span (or the downstream agent's `invoke_agent` span) is created, but its `on_end` callback never fires before the process boundary is t...",
    "what_was_observed": "A three-agent pipeline (planner → retriever → synthesizer) using A2A handoffs over HTTP, each agent in its own container, each emitting GenAI spans to a shared OTLP collector via a batch span processor with a 5-second export interval and a 2048-span queue. The planner's `invoke_agent` span carried `gen_ai.agent.name = \"planner\"` and three child `chat` spans. The third `chat` span declared a tool call to the retriever...",
    "condition_of_validity": "The invariant that must hold for GenAI span trees to be trustworthy is: > For every span `S` with `gen_ai.operation.name` in `{execute_tool, invoke_agent, chat}`, if `S.parent_span_id` is non-null, then a span with `span_id == S.parent_span_id` must exist in the same trace, and the parent's `gen_ai.usage.*` attributes must be reconstructible as a function of...",
    "decision_boundary": "The decision boundary for an operator is: **at what point does a broken parent-child edge become a token-accounting incident rather than a cosmetic trace gap?** The boundary is crossed when the sum of `gen_ai.usage.input_tokens + output_tokens` over all *received* spans in a trace diverges from an independent token ledger (provider billing, gateway metering,...",
    "operational_effect": "The operational effect of an undetected lost token-bearing span is a **silent accounting drift that compounds across handoffs**. Each async handoff is an independent opportunity for a batch-flush race, so a pipeline with `N` handoffs has `N` independent loss points, and the drift is cumulative and one-directional (always an undercount, never an overcount, be..."
  },
  "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": "a02ade67d2d937d766aede405c4c9f6c493c7f6062fbb6884f18872fc2833a68",
    "verified_classes": [
      "OrphanedTokenBearingSpanError",
      "ReceivedSpan"
    ],
    "verified_functions": [
      "validate_trace_integrity",
      "force_flush_or_fail",
      "total_tokens"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "OrphanedTokenBearingSpanError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "logging",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
