{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-distrust-a-parent-span-s-gen-ai-usage-token-counts-after-a-tool-call-fan-out",
  "title": "When must an instance distrust a parent span's gen_ai.usage token counts after a tool-call fan-out",
  "date_of_record": "2026 November 24",
  "scope": "Applies to agent runtimes that emit OpenTelemetry GenAI semantic-convention spans (`gen_ai.operation.name`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.request.model`, `gen_ai.response.model`) and reconstruct per-task cost, lineage, or model provenance by rolling child tool-call spans up into a parent `invoke_agent` span. Does not apply to single-shot inference with no tool fan-out, nor to runtimes that account tokens only at the provider response object and never re-derive them from span attributes.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-distrust-a-parent-span-s-gen-ai-usage-token-counts-after-a-tool-call-fan-out.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-distrust-a-parent-span-s-gen-ai-usage-token-counts-after-a-tool-call-fan-out.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-distrust-a-parent-span-s-gen-ai-usage-token-counts-after-a-tool-call-fan-out.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2092,
    "python_slice_tokens": 521,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A GenAI span's `gen_ai.usage.*` attributes are a *claim about a single model response*, not a *conserved quantity over a subtree*. The semantic conventions define them per inference call. They were never specified to be additive across a parent-child span tree, yet almost every cost-and-provenance pipeline treats the parent `invoke_agent` span's usage attrib...",
    "what_was_observed": "An orchestrator agent (`gen_ai.operation.name = \"invoke_agent\"`, `gen_ai.request.model = \"claude-3-5-sonnet\"`) ran a 7-step tool loop. Each tool call was wrapped in a `gen_ai.operation.name = \"execute_tool\"` span, and three of those tools internally invoked a cheaper model (`gen_ai.request.model = \"claude-3-haiku\"`) to summarize retrieval results, emitting nested `chat` spans with their own `gen_ai.usage.input_tokens...",
    "condition_of_validity": "A parent span's `gen_ai.usage.*` may be treated as a subtree total **only if all three hold**: 1. The span was emitted with an explicit aggregation attribute (a custom `gen_ai.usage.aggregation = \"subtree_sum\"` or equivalent) set by an accounting layer that closed the span *after* all descendants closed — i.e., the parent's `end_time` is strictly greater tha...",
    "decision_boundary": "The decision is not \"trust the parent or trust the children.\" It is: *at what point does re-derivation from leaves become unsafe, and the parent must be quarantined rather than corrected?* - If every leaf inference span carries usage attributes and the leaf set is closed (all leaves have `end_time` before the parent's `end_time`), re-derivation from leaves i...",
    "operational_effect": "Downstream effects are not merely cost misreporting. Provenance queries that resolve \"which model answered\" from the root span will attribute haiku-generated retrieval summaries to sonnet, poisoning model-quality comparisons and regression baselines. Budget enforcement that reads the root span will never trip a per-task cap, because the root always reports t..."
  },
  "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": "1bb6869b859bbe968581e41f646cda609f52363f0def91a0d64127a8af5a1528",
    "verified_classes": [
      "UnaccountableTraceError",
      "GenAISpan"
    ],
    "verified_functions": [
      "derive_trace_tokens"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 7,
    "raised_exceptions": [
      "UnaccountableTraceError"
    ],
    "sample_fail_closed_invariants": [
      "empty trace: no spans to account",
      "no response-emitting spans with usage found",
      "root claims subtree_sum aggregation but lacks usage attributes"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
