{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-a-broken-parent-child-span-chain-in-opentelemetry-genai-agent-handoffs-and-how-token-attribution-silently-double-coun",
  "title": "What structural signals indicate a broken parent-child span chain in OpenTelemetry GenAI agent handoffs, and how token attribution silently double-counts across the delegation boundary",
  "date_of_record": "2026 November 22",
  "scope": "Applies to agent systems emitting OpenTelemetry GenAI semantic-convention spans where an orchestrator agent delegates to a sub-agent (or tool-calling loop) and both layers independently emit `gen_ai.usage.input_tokens` / `gen_ai.usage.output_tokens`. Does not apply to single-agent, single-span instrumentation with no delegation boundary, nor to pure transport-layer tracing (HTTP/gRPC) without GenAI semantic attributes.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-broken-parent-child-span-chain-in-opentelemetry-genai-agent-handoffs-and-how-token-attribution-silently-double-coun.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-broken-parent-child-span-chain-in-opentelemetry-genai-agent-handoffs-and-how-token-attribution-silently-double-coun.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-broken-parent-child-span-chain-in-opentelemetry-genai-agent-handoffs-and-how-token-attribution-silently-double-coun.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1777,
    "python_slice_tokens": 378,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **span nesting as a trace-structure fact** and **token attribution as a billing/accounting fact**. OpenTelemetry's GenAI conventions define `gen_ai.usage.*` attributes as *per-inference* counts — the tokens consumed by that specific model invocation. But the convention also encourages parent spans (`invoke_agent`, `exe...",
    "what_was_observed": "An orchestrator agent (`invoke_agent` span, `gen_ai.agent.name=planner`) received a task, performed a planning inference (1,850 input / 420 output tokens), then delegated to a `researcher` sub-agent via a tool-call-shaped handoff (`execute_tool`, `gen_ai.tool.name=delegate_to_researcher`). The sub-agent span (`invoke_agent`, `gen_ai.agent.name=researcher`) performed three retrieval-augmented inferences totaling 12,40...",
    "condition_of_validity": "The invariant \"sum of `gen_ai.usage.*` across all spans equals true model consumption\" holds **only if exactly one span per inference carries usage attributes and no span both performs inference and aggregates children**. This condition is violated by construction in any delegating agent that: 1. Emits usage on its own `invoke_agent` span for its local infer...",
    "decision_boundary": "The boundary is: **do you aggregate usage at emit time (on the parent span) or at query time (via span-tree traversal)?** - If you aggregate **at emit time**, you must (a) never also emit direct usage on the same span, and (b) guarantee the child set is complete and final before the parent span closes. Async delegation and retries break (b), producing overwr...",
    "operational_effect": "The operational consequence is that **token-cost dashboards and budget guardrails built on naive span summation over-report by the delegation fan-out factor**, and the over-report is *stable and plausible* — it does not trip anomaly detection because it scales smoothly with task complexity. Budget-exhaustion guardrails that halt an agent when cumulative `gen..."
  },
  "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": "268901fcfea2e2063fa0cbf5c0ac3d33ecbb69e0173f3f7a41ffb7b2f2565bd7",
    "verified_classes": [
      "UsageAttributionError",
      "GenAISpan"
    ],
    "verified_functions": [
      "validate_usage_attribution",
      "_collect_direct_descendants"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "UsageAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
