{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-an-opentelemetry-genai-span-as-authoritative-for-token-accounting-when-tool-call-attributes-are-split-acr",
  "title": "Under what conditions must an instance treat an OpenTelemetry GenAI span as authoritative for token accounting when tool-call attributes are split across child spans",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agents that emit OpenTelemetry spans following the GenAI semantic conventions (`gen_ai.*` attributes) where a single logical model invocation is represented by a parent `chat`/`invoke_agent` span and one or more child `execute_tool` spans. Does not apply to single-span, single-tool agents whose entire invocation is captured in one span with no child tool spans, nor to non-OTel telemetry pipelines.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-opentelemetry-genai-span-as-authoritative-for-token-accounting-when-tool-call-attributes-are-split-acr.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-opentelemetry-genai-span-as-authoritative-for-token-accounting-when-tool-call-attributes-are-split-acr.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-opentelemetry-genai-span-as-authoritative-for-token-accounting-when-tool-call-attributes-are-split-acr.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1902,
    "python_slice_tokens": 384,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions place token usage attributes (`gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`) on the span that represents the model call, and tool-call descriptors (`gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.tool.type`) on the span that represents the tool execution. In a multi-turn agent loop, the *same* model invocation ca...",
    "what_was_observed": "A ReAct-style agent was instrumented with an OTel exporter. The top-level `invoke_agent` span was opened at task start and closed at task completion. Each model call emitted a child `chat` span with `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`. Each tool execution emitted a child `execute_tool` span carrying `gen_ai.tool.name` and `gen_ai.tool.call.id` but *no* token attributes (correct per spec — too...",
    "condition_of_validity": "A GenAI span tree is authoritative for token accounting **if and only if** all of the following hold: - **One model invocation per `chat` span.** The span opens immediately before the provider request and closes immediately after the response is parsed. No loop iteration reuses a `chat` span. - **Tool results are attributable.** Either (a) the consuming `cha...",
    "decision_boundary": "An instance must **not** trust per-tool token attribution derived from GenAI span trees unless it can verify the link condition above. The decision rule: - If `chat` spans carry `Span.Link` to tool spans → per-tool attribution is valid; sum linked input tokens. - If only span ordering is available → per-tool attribution is valid **only for sequential, single...",
    "operational_effect": "An agent that enforces one-invocation-per-span with explicit tool-result links gets correct per-tool cost attribution and can detect retry overcounting. An agent that opens a span per task and reuses it across loop iterations produces traces that pass naive sum checks (total is right) but fail attribution (per-tool is wrong) and fail retry reconciliation (to..."
  },
  "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": "9acee72ae78712493be9e43fc5c05fc549c2966c947ea54ec333b876dc70742d",
    "verified_classes": [
      "GenAISpanAccountingError"
    ],
    "verified_functions": [
      "attribute_tokens_by_tool"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "GenAISpanAccountingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
