{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-reject-a-genai-span-whose-token-accounting-attributes-were-inherited-across-a-tool-call-boundary",
  "title": "Under what conditions must an instance reject a GenAI span whose token-accounting attributes were inherited across a tool-call boundary",
  "date_of_record": "2026 November 26",
  "scope": "Applies to any agent runtime that emits OpenTelemetry spans conforming to the GenAI semantic conventions (`gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.tool.call.id`) and that wraps tool execution inside a parent LLM-invocation span. Does not cover pure tracing of non-LLM RPCs, nor span export/transport concerns (OTLP retry, batching) except where they interact with attribute inheritance.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-span-whose-token-accounting-attributes-were-inherited-across-a-tool-call-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-span-whose-token-accounting-attributes-were-inherited-across-a-tool-call-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-span-whose-token-accounting-attributes-were-inherited-across-a-tool-call-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2106,
    "python_slice_tokens": 457,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define `gen_ai.usage.*` as attributes of a *model invocation* — the token cost of a single request/response pair against a specific model. They are **not** span-scoped cumulative counters, and they are **not** inheritable. The failure mode here is architectural: an agent runtime creates a child span for tool execution, and beca...",
    "what_was_observed": "A multi-step agent executing a `search → read → summarize` chain emitted the following trace (abridged, one representative run): Downstream cost aggregation summed `gen_ai.usage.output_tokens` across all spans in the trace and reported 210 × 4 = 840 output tokens for a single-turn interaction that actually consumed 210. The billing dashboard over-reported by 4× for this trace, and the ratio scaled with tool-call fan-...",
    "condition_of_validity": "The invariant is only well-defined — and the rejection is only correct — under the following conditions. If any fail, the span may legitimately carry usage attributes and must not be rejected: - **Condition A — Operation classification.** The span's `gen_ai.operation.name` is `execute_tool` (or equivalent tool-execution operation) *and* the tool implementati...",
    "decision_boundary": "The boundary is between **\"usage attribute present\"** and **\"usage attribute inherited.\"** The GenAI conventions give no explicit marker for the latter, so the runtime must impose one. The decision procedure at span-close time: 1. If `gen_ai.operation.name != execute_tool` → do not apply this check; emit normally. 2. Walk to the nearest ancestor with `gen_ai...",
    "operational_effect": "Enforcing the boundary changes three things: - **Cost telemetry becomes additive-correct.** With inheritance rejected, `sum(gen_ai.usage.output_tokens)` over a trace equals the true model cost regardless of tool fan-out. Without it, the sum is a function of the model's own tool-call decisions — an unstable metric that cannot be alerted on. - **The rejection ..."
  },
  "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": "8f6ddb049fbfd3d3e99a0d58bece8a3305e88bb339e386c714ba0498d6789950",
    "verified_classes": [
      "InheritedUsageError",
      "FabricatedUsageError",
      "Span"
    ],
    "verified_functions": [
      "_nearest_model_ancestor",
      "validate_usage_provenance",
      "process_span",
      "get"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "FabricatedUsageError",
      "InheritedUsageError"
    ],
    "sample_fail_closed_invariants": [
      "assert 'gen_ai.usage.output_tokens' not in cleaned.attributes"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
