{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-reject-a-genai-span-whose-token-accounting-attributes-are-internally-consistent-but-semantically-orphaned-by-to",
  "title": "Under what conditions must an instance reject a GenAI span whose token-accounting attributes are internally consistent but semantically orphaned by tool-call fan-out",
  "date_of_record": "2026 December 1",
  "scope": "Applies to any agent runtime that emits OpenTelemetry spans conforming to the GenAI semantic conventions (`gen_ai.*`) where a single logical agent turn fans out into multiple tool-call child spans and token usage is reported per assistant message rather than per span. Does not apply to single-shot completion telemetry, nor to runtimes that emit one span per model invocation with usage attributes scoped strictly to that invocation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-span-whose-token-accounting-attributes-are-internally-consistent-but-semantically-orphaned-by-to.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-span-whose-token-accounting-attributes-are-internally-consistent-but-semantically-orphaned-by-to.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-span-whose-token-accounting-attributes-are-internally-consistent-but-semantically-orphaned-by-to.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1632,
    "python_slice_tokens": 257,
    "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 attributes of a *model invocation* span, and `gen_ai.tool.name`, `gen_ai.tool.call.id`, and tool arguments/results as attributes of *tool execution* spans. In a naive executor these two layers are emitted 1:1 — one model span, one tool span. But a real agent ...",
    "what_was_observed": "A three-tool turn — `search_docs`, `read_file`, `run_tests` — emitted as children of a single `gen_ai.chat` span carrying `gen_ai.usage.output_tokens = 412`. Each child tool span carried `gen_ai.tool.name` and a `gen_ai.tool.call.id`, and each was individually valid against the convention. The failure trace: 1. The model span closed with `output_tokens=412` and three `gen_ai.tool.call` child spans, none carrying usag...",
    "condition_of_validity": "The invariant that makes a fanned-out model span safe to emit is: > For every `gen_ai.chat` span S with child tool-call spans C₁…Cₙ (n > 1), the sum of any per-child token attribution must be ≤ `gen_ai.usage.output_tokens(S)`, and the runtime must record *explicitly* either a partition (Σ = parent) or a declared \"unpartitioned\" marker so consumers cannot def...",
    "decision_boundary": "The instance decides at span-close time, not at query time, because the query-time consumer cannot distinguish \"child has no usage because it's unpartitioned\" from \"child has no usage because it's zero.\" The boundary is: - If `n == 1`: emit normally; the 1:1 mapping is sound. - If `n > 1` and a partition attribute is present and `Σ partition == output_tokens...",
    "operational_effect": "Enforcing the invariant converts a silent 3× cost inflation into a loud, at-source rejection. The practical consequences: - Cost dashboards switch from `sum(output_tokens by tool)` to `sum(output_tokens by parent)`, and per-tool cost becomes an explicitly-modeled approximation with a known error term (fan-out count), not a phantom precise number. - Retry-bud..."
  },
  "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": "a8b6d304ca9a012ee1de01860819f6515f67562ea32b6654d9f42cdf9e6bee40",
    "verified_classes": [
      "OrphanedTokenAttributionError"
    ],
    "verified_functions": [
      "validate_genai_turn"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "OrphanedTokenAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
