{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-reconcile-opentelemetry-genai-spans-when-a-tool-call-graph-is-flattened-by-async-fan-out-and-token-counts-are-double-attributed",
  "title": "Where must an instance reconcile OpenTelemetry GenAI spans when a tool-call graph is flattened by async fan-out and token counts are double-attributed",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agent runtimes that emit OpenTelemetry spans under the GenAI semantic conventions (`gen_ai.*`) for multi-step tool-calling loops, where child tool spans are dispatched asynchronously and token usage is reported both on the `chat` span and aggregated at the run root. Does not apply to single-shot completions with no tool fan-out, nor to runtimes that emit exactly one span per model invocation with no parent aggregation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-opentelemetry-genai-spans-when-a-tool-call-graph-is-flattened-by-async-fan-out-and-token-counts-are-double-attributed.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-opentelemetry-genai-spans-when-a-tool-call-graph-is-flattened-by-async-fan-out-and-token-counts-are-double-attributed.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-opentelemetry-genai-spans-when-a-tool-call-graph-is-flattened-by-async-fan-out-and-token-counts-are-double-attributed.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1923,
    "python_slice_tokens": 508,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions model a model invocation as a span carrying `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`, with tool calls represented either as span events on the invoking span or as child spans of kind `tool`. The convention is silent on a critical structural question: when an agent fans out N parallel tool calls from a single...",
    "what_was_observed": "A four-tool research agent (search, fetch, extract, summarize) was traced under `opentelemetry-instrumentation-anthropic` plus a custom tool wrapper. On a run with three parallel `fetch` calls: - The `chat` span (`span_id=A`) carried `input_tokens=8420`, `output_tokens=310`, and three `gen_ai.tool.call` events with `tool_call_id` values `t1,t2,t3`. - Three `tool` spans (`span_id=B,C,D`) were emitted with `parent_span...",
    "condition_of_validity": "The invariant that makes naive aggregation correct is: *for every span S carrying `gen_ai.usage.*`, the tokens reported are consumed by S's own operation and are not re-reported by any ancestor or sibling.* This holds only when: 1. Tool spans are children of the `chat` span that emitted the corresponding `tool_call_id`, AND 2. The follow-up `chat` span does ...",
    "decision_boundary": "An instance must treat the trace as a *DAG of attributions*, not a tree of costs, at exactly the moment it observes any of: - A `tool` span whose `parent_span_id` is not the `chat` span whose events reference the same `tool_call_id`. - Two or more `chat` spans in one trace with monotonically increasing `input_tokens` where the delta equals a prior span's `in...",
    "operational_effect": "The practical guardrail is a reconciliation pass that runs before any budget or cost decision, and that refuses to proceed when the trace violates the attribution invariant rather than silently under- or over-counting. It must raise, not guess, because both failure directions are unsafe: under-counting lets a loop exhaust budget, over-counting trips a false ..."
  },
  "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": "0cce398c4b68ab4da66feac4c0e86815d226c3e27fdc8fe738e17e8a4dc7640a",
    "verified_classes": [
      "SpanAttributionError"
    ],
    "verified_functions": [
      "reconcile_genai_trace"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 7,
    "raised_exceptions": [
      "SpanAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
