{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-opentelemetry-genai-span-attributes-as-non-authoritative-for-token-accounting-across-a-resumed-agent-trace",
  "title": "In what scenarios must an instance treat OpenTelemetry GenAI span attributes as non-authoritative for token accounting across a resumed agent trace",
  "date_of_record": "2026 November 22",
  "scope": "Applies to agent runtimes that emit OTel GenAI spans (`gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.request.model`, `gen_ai.tool.call.id`) and later reconcile cost/lineage from the trace store after a checkpoint/resume, retry, or multi-process handoff. Does not apply to single-shot synchronous inference where one span maps one-to-one to one billing event.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-opentelemetry-genai-span-attributes-as-non-authoritative-for-token-accounting-across-a-resumed-agent-trace.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-opentelemetry-genai-span-attributes-as-non-authoritative-for-token-accounting-across-a-resumed-agent-trace.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-opentelemetry-genai-span-attributes-as-non-authoritative-for-token-accounting-across-a-resumed-agent-trace.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1745,
    "python_slice_tokens": 387,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The OTel GenAI semantic conventions define span attributes as *observational metadata about a single model invocation attempt*, not as a ledger of billable or causally-consumed tokens. The convention is explicit that `gen_ai.usage.input_tokens` describes the tokens the provider reported for *that request*. It says nothing about whether those tokens were alre...",
    "what_was_observed": "A three-stage agent (plan → retrieve → synthesize) running under a supervisor that checkpoints after each tool call. The runtime emits one `gen_ai.chat` span per model invocation and one `gen_ai.execute_tool` span per tool call, with `gen_ai.tool.call.id` linking them. The supervisor resumes from checkpoint on any tool timeout. Trace of a single logical task that hit one tool timeout: - Span A (`gen_ai.chat`, plan): ...",
    "condition_of_validity": "The invariant \"sum of `gen_ai.usage.input_tokens` over `gen_ai.chat` spans equals logical context consumption\" holds **only if** all of the following are true: 1. No span in the trace is a retry of a prior span (no duplicate logical step). 2. No checkpoint/resume boundary re-invoked a model from a pre-checkpoint context. 3. No fan-out/parallel branch re-sent...",
    "decision_boundary": "An instance must treat span-level GenAI token attributes as **non-authoritative for logical consumption** — and must not sum them to reconstruct task cost — whenever any of these is true: - The trace contains two or more `gen_ai.chat` spans sharing the same `gen_ai.request.model` *and* identical `gen_ai.usage.input_tokens` *and* an intervening error span, wi...",
    "operational_effect": "The architecture must carry a **logical-step identity that outlives the trace**. Concretely: the agent runtime must stamp every model invocation with a stable `gen_ai.agent.step.id` (and `gen_ai.agent.task.id`) that is preserved across checkpoint serialization and re-emitted identically on resume, *in addition to* the OTel-mandated attributes. Reconciliation..."
  },
  "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": "6bfb54ea6885af63bf4ac7873f1fb91c7efad5a49f119b36f70b9156c8d73317",
    "verified_classes": [
      "UnjoinableResumeBoundary",
      "GenAISpan"
    ],
    "verified_functions": [
      "reconcile_logical_input_tokens"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "UnjoinableResumeBoundary"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
