{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-refuse-to-terminate-a-genai-agent-span-whose-gen-ai-usage-input-tokens-was-reported-as-zero-by-the-model-backen",
  "title": "Under what conditions must an instance refuse to terminate a GenAI agent span whose `gen_ai.usage.input_tokens` was reported as zero by the model backend",
  "date_of_record": "2026 November 14",
  "scope": "Applies to OpenTelemetry GenAI semantic-convention instrumentation of agent and tool-call spans (agent invocation, sub-agent delegation, tool execution) where the model backend returns a usage block on the response object. Does not apply to streaming responses that omit usage entirely, nor to embedding or reranker spans, which have separate accounting obligations.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-terminate-a-genai-agent-span-whose-gen-ai-usage-input-tokens-was-reported-as-zero-by-the-model-backen.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-terminate-a-genai-agent-span-whose-gen-ai-usage-input-tokens-was-reported-as-zero-by-the-model-backen.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-terminate-a-genai-agent-span-whose-gen-ai-usage-input-tokens-was-reported-as-zero-by-the-model-backen.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1513,
    "python_slice_tokens": 472,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that operators conflate is between **\"the model produced no tokens\"** and **\"the usage block was zeroed by the transport.\"** A `gen_ai.usage.input_tokens = 0` attribute is semantically a *measurement*, not an *absence*. The GenAI conventions require that when a usage block is present, the value is authoritative; when it is absent, the attribu...",
    "what_was_observed": "During a multi-turn agent run against a backend that silently omits the `usage` object for cached prompt-prefix hits (a known behavior of one hosted inference tier), the instrumentation layer's usage extractor returned `None`, and a downstream normalizer defaulted `None` to `0`. The resulting spans carried: - `gen_ai.operation.name = \"chat\"` - `gen_ai.usage.input_tokens = 0` - `gen_ai.usage.output_tokens = 0` - `gen_...",
    "condition_of_validity": "The refusal-to-terminate rule is valid only when all of the following hold: 1. The response object carried a usage block (or an explicit `usage_present` flag) — i.e., the backend is contractually obligated to report usage for this call class. 2. The completion content is non-empty (at least one `gen_ai.completion.*.content` or tool-call argument is present)....",
    "decision_boundary": "The boundary is between *normalization* and *fabrication*. A normalizer may map an absent usage block to an absent attribute. It may **not** map an absent usage block to `0`, and it may **not** map a present-but-zero usage block to a successful terminal span when a completion is attached. When the contradictory state is detected, the span must be ended with ...",
    "operational_effect": "Downstream consumers — cost meters, loop detectors, context-window planners — all assume the token attributes are either absent or truthful. A fabricated zero is indistinguishable from a genuine zero after export, so the quarantine must happen *before* the span processor sees it. In practice this means the instrumentation's usage extractor and the span-closi..."
  },
  "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": "551a0d059aff28357f05f6982e8bfe0125d811c97ba440562503294bf4b9e720",
    "verified_classes": [
      "GenAIUsageAccountingError",
      "SpanUsageSnapshot"
    ],
    "verified_functions": [
      "validate_agent_span_usage",
      "close_agent_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "GenAIUsageAccountingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
