{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-opentelemetry-genai-span-attributes-as-lossy-projections-rather-than-authoritative-state-for-token-accounting",
  "title": "In what scenarios must an instance treat OpenTelemetry GenAI span attributes as lossy projections rather than authoritative state for token accounting and tool-call reconstruction",
  "date_of_record": "2026 November 20",
  "scope": "Applies to any agent runtime that emits OpenTelemetry GenAI semantic-convention spans (`gen_ai.*` attributes, `execute_tool` spans, `chat` spans) and later reads those spans back as the source of truth for token-budget enforcement, tool-call replay, or cost reconciliation. Does not apply to runtimes that treat telemetry purely as fire-and-forget observability with no feedback into control flow.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-opentelemetry-genai-span-attributes-as-lossy-projections-rather-than-authoritative-state-for-token-accounting.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-opentelemetry-genai-span-attributes-as-lossy-projections-rather-than-authoritative-state-for-token-accounting.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-opentelemetry-genai-span-attributes-as-lossy-projections-rather-than-authoritative-state-for-token-accounting.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2008,
    "python_slice_tokens": 438,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define a *wire projection* of an agent's execution: a set of attributes (`gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.request.model`) intended for aggregation and correlation. They were never specified as a lossless serialization of the ag...",
    "what_was_observed": "A multi-step agent using a tool-calling loop emitted one `chat` span per model turn and one `execute_tool` span per tool invocation, with `gen_ai.usage.input_tokens` / `gen_ai.usage.output_tokens` recorded on each `chat` span. A budget governor subscribed to the span stream and summed `input_tokens + output_tokens` to enforce a hard per-task ceiling. Three distinct failures appeared, all spec-conformant: 1. **Samplin...",
    "condition_of_validity": "The invariant holds — telemetry may be treated as authoritative state — only when *all* of the following are satisfied: - **Sampling is `always_on` for the spans that feed control flow**, or the governor consumes a separate, non-sampled accounting channel (e.g., provider-side usage records or a synchronous counter incremented at the call site, not at span em...",
    "decision_boundary": "The boundary is between **soft accounting** (dashboards, cost attribution, post-hoc analysis — where projection loss is acceptable because errors are statistical and non-operative) and **hard accounting** (budget enforcement, replay/resume, idempotency decisions — where a single dropped or ambiguous span produces an incorrect irreversible action). Concretely...",
    "operational_effect": "Once the instance treats `gen_ai.*` as a lossy projection, three behaviors change. First, budget enforcement moves to a synchronous counter that increments on token receipt and is reconciled (not replaced) by summed span usage; divergence between the two is itself a monitored signal — a growing gap means sampling or retry ambiguity is corrupting the trace, n..."
  },
  "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": "5a513953b0431c16ed5852302639e1e35245ed1cf1e759f3d97d3934eff30ab4",
    "verified_classes": [
      "TelemetryProjectionError"
    ],
    "verified_functions": [
      "enforce_budget_from_spans",
      "reconstruct_tool_call"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "TelemetryProjectionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
