{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-reject-a-resumed-otel-genai-agent-span-when-gen-ai-usage-input-tokens-is-replayed-from-a-checkpoint-after-a-tool-ca",
  "title": "In what scenarios must an instance reject a resumed OTel GenAI agent span when `gen_ai.usage.input_tokens` is replayed from a checkpoint after a tool-call retry?",
  "date_of_record": "2026 November 28",
  "scope": "Applies to agent runtimes that emit OpenTelemetry spans conforming to the GenAI semantic conventions (`gen_ai.*`) and that checkpoint/resume mid-task, including retried tool calls. Does not apply to stateless single-shot inference spans with no checkpoint or retry boundary.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-a-resumed-otel-genai-agent-span-when-gen-ai-usage-input-tokens-is-replayed-from-a-checkpoint-after-a-tool-ca.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-a-resumed-otel-genai-agent-span-when-gen-ai-usage-input-tokens-is-replayed-from-a-checkpoint-after-a-tool-ca.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-a-resumed-otel-genai-agent-span-when-gen-ai-usage-input-tokens-is-replayed-from-a-checkpoint-after-a-tool-ca.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1894,
    "python_slice_tokens": 361,
    "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 cumulative* counters describing the token cost of the operation the span represents. They are not per-attempt deltas, and they are not idempotent across replay. The distinction that matters: a *span* is a logical unit of work (one model invocation o...",
    "what_was_observed": "Trace from a research agent with a checkpoint at the tool-call boundary. The agent calls a retrieval tool, the tool returns, the model produces a follow-up invocation, and the process is killed mid-stream (OOM) after the checkpoint is written but before the follow-up span is exported. On resume, the runtime loads the checkpoint — which includes the prior span's `gen_ai.usage.input_tokens=18432`, `gen_ai.usage.output_...",
    "condition_of_validity": "The replay is *safe* (usage attributes may be carried forward) only when all of the following hold: - The checkpointed span was **already exported and acknowledged** by the collector before the crash, so the replayed span is a genuine *duplicate* that dedup-by-span-ID will collapse, not a *replacement* of a lost span. - The `trace_id` and `span_id` are **pre...",
    "decision_boundary": "The runtime must decide, at resume time, between two mutually exclusive paths: - **Replay path** (carry checkpointed usage): admissible only if the span was durably exported *and* the resumed execution is a no-op replay (tool result served from cache, model invocation skipped). In this case emit the span with the original `span_id` and original usage; the ba...",
    "operational_effect": "Downstream, the mislabeled span corrupts three things: (1) cost dashboards under-report because the lost attempt's tokens vanish and the retried attempt's real tokens are replaced by the stale count; (2) `gen_ai.usage.input_tokens` histograms develop a bimodal artifact where \"replayed\" spans cluster at the checkpointed value regardless of actual prompt size,..."
  },
  "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": "52c50aedb55dd280820c26343b7a45aca576bb225980d618098904109789d77e",
    "verified_classes": [
      "ReplayedUsageViolation",
      "CheckpointedSpan",
      "ResumeContext"
    ],
    "verified_functions": [
      "build_resumed_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ReplayedUsageViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
