{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-refuse-to-emit-a-gen-ai-usage-input-tokens-value-when-a-tool-call-span-is-nested-inside-a-reasoning-span",
  "title": "Under what conditions must an instance refuse to emit a `gen_ai.usage.input_tokens` value when a tool-call span is nested inside a reasoning span",
  "date_of_record": "2026 November 24",
  "scope": "Applies to agents that emit OpenTelemetry GenAI spans where a `execute_tool` span is parented under an LLM reasoning/inference span and both carry `gen_ai.usage.*` attributes. Does not apply to flat, single-span tool invocations or to providers that report usage only at the request level.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-emit-a-gen-ai-usage-input-tokens-value-when-a-tool-call-span-is-nested-inside-a-reasoning-span.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-emit-a-gen-ai-usage-input-tokens-value-when-a-tool-call-span-is-nested-inside-a-reasoning-span.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-emit-a-gen-ai-usage-input-tokens-value-when-a-tool-call-span-is-nested-inside-a-reasoning-span.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1584,
    "python_slice_tokens": 278,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens` as *per-inference* counters. They are defined against a single model invocation: the tokens the provider billed for one `chat`/`completion` request. They are **not** cumulative counters and they are **not** additive across a span subtree. The non-obvious boundar...",
    "what_was_observed": "A production agent running a ReAct loop emitted the following trace shape for a single user turn: - `invoke_agent` (root) - `chat` (reasoning step, `gen_ai.usage.input_tokens=1840`, `output_tokens=212`) - `execute_tool` (search, `gen_ai.usage.input_tokens=1840`, `output_tokens=212`) ← inherited - `chat` (second reasoning step, `gen_ai.usage.input_tokens=2210`, `output_tokens=180`) The `execute_tool` span had no model...",
    "condition_of_validity": "The refusal to emit usage on a tool-call span is *required* under all of the following simultaneously: - The tool-call span's `gen_ai.operation.name` is `execute_tool` (or the tool is a non-model operation such as file I/O, HTTP fetch, code execution). - The tool-call span has no child `chat`/`text_completion`/`embeddings` span of its own. - The parent span ...",
    "decision_boundary": "The boundary between \"emit\" and \"refuse\" is a single predicate evaluated at `on_start`: Everything else refuses. The predicate is *structural*, not value-based: it depends on span kind and tree position, not on whether a usage value happens to be in scope. This matters because the most common bug is not \"wrong value\" but \"value present when it should be abse...",
    "operational_effect": "Enforcing the refusal changes three downstream behaviors: 1. **Cost reconciliation closes.** Per-trace token sums match provider invoices within rounding once inheritance is removed. The 45% inflation in the observed case dropped to 0.3% (residual from tokenizer differences between the SDK's local count and the provider's count). 2. **Fan-out cost is correct..."
  },
  "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": "ea3ad9161279aedd5f4d1c9a14fa9af57bec5925cd9741843097d9cec969851a",
    "verified_classes": [
      "UsageAttributionError",
      "Span"
    ],
    "verified_functions": [
      "should_emit_usage",
      "assign_usage",
      "on_start",
      "__post_init__"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "UsageAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
