{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-reject-a-genai-span-whose-gen-ai-usage-input-tokens-was-emitted-by-a-resumed-turn-and-how-does-the-resumed-turn",
  "title": "Under what conditions must an instance reject a GenAI span whose `gen_ai.usage.input_tokens` was emitted by a resumed turn, and how does the resumed-turn double-count corrupt cost attribution across the trace?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to any agent runtime that emits OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) for LLM turns, tool calls, and agent-turn boundaries, where a turn can be checkpointed and resumed across a process, host, or container boundary. Does not apply to single-shot, non-resumable inference where the span lifecycle is strictly contained within one process invocation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-span-whose-gen-ai-usage-input-tokens-was-emitted-by-a-resumed-turn-and-how-does-the-resumed-turn.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-span-whose-gen-ai-usage-input-tokens-was-emitted-by-a-resumed-turn-and-how-does-the-resumed-turn.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-span-whose-gen-ai-usage-input-tokens-was-emitted-by-a-resumed-turn-and-how-does-the-resumed-turn.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1949,
    "python_slice_tokens": 240,
    "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 **per-span, per-completion facts** — attributes describing what the model actually billed for that specific request/response pair. They are *not* cumulative counters and they are *not* deltas relative to a session. The convention assumes a one-to-one binding ...",
    "what_was_observed": "A tool-calling agent was instrumented with a `gen_ai.chat` span per LLM call and a `gen_ai.execute_tool` span per tool invocation, with the agent turn wrapped in an `invoke_agent` span. The runtime checkpointed agent state (message history, pending tool call, partial assistant message) to durable storage every N tokens. On a downstream tool timeout, the executor resumed from the last checkpoint and re-issued the LLM ...",
    "condition_of_validity": "The invariant holds — that is, the trace's token accounting is trustworthy — only when all of the following are true: - **Exactly-once span emission per model invocation.** Either the pre-checkpoint span is *retracted* (emitted as a span with `status=error` and zero usage, or not exported at all) before the resumed span is emitted, or the resumed span carrie...",
    "decision_boundary": "An instance must **reject** (fail closed on) a GenAI span at emission time when: - It is emitted from a resume path and the runtime cannot prove the original span was retracted or is being linked — reject rather than emit a duplicate. - `gen_ai.usage.input_tokens` on a resumed span is copied from checkpoint metadata rather than measured against the actual re...",
    "operational_effect": "The practical consequence is that **trace-level token cost is only as reliable as the runtime's resume discipline, and the semantic conventions provide no guardrail for it.** Teams that instrument with the conventions and trust the resulting dashboards will, on any workload with checkpoint/resume, systematically mis-attribute cost — in one direction or the o..."
  },
  "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": "8e51795d28dbe1c5b650370e5da2be3515263e67f12098000e2deb025a0b6be6",
    "verified_classes": [
      "ReplayedSpanAccountingError",
      "GenAISpanRegistry"
    ],
    "verified_functions": [
      "__init__",
      "admit_chat_span",
      "admit_tool_span"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ReplayedSpanAccountingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
