{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-opentelemetry-genai-span-attributes-as-non-authoritative-for-cost-accounting-when-tool-call-emission-is-d",
  "title": "Under what conditions must an instance treat OpenTelemetry GenAI span attributes as non-authoritative for cost accounting when tool-call emission is deferred across a checkpoint boundary",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents that emit OpenTelemetry GenAI spans (`gen_ai.*` attributes per the GenAI semantic conventions) while executing multi-step tool loops that may checkpoint and resume. Does not apply to single-shot inference calls that complete within one span lifetime, nor to billing reconciliation performed directly against provider-side usage APIs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-span-attributes-as-non-authoritative-for-cost-accounting-when-tool-call-emission-is-d.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-span-attributes-as-non-authoritative-for-cost-accounting-when-tool-call-emission-is-d.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-span-attributes-as-non-authoritative-for-cost-accounting-when-tool-call-emission-is-d.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1929,
    "python_slice_tokens": 390,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens` as attributes on the span that represents the model invocation, and downstream cost pipelines commonly sum these attributes across spans to produce per-trace cost. This is sound only when the span's lifetime is coextensive with the model call it describes. The ...",
    "what_was_observed": "A tool-loop agent (planner → 3–6 tool calls → synthesizer) was instrumented with one `gen_ai.chat` span per model invocation, plus `gen_ai.tool.call` child spans per tool execution. Checkpointing occurred after every tool result, persisting conversation state and an in-flight span context (trace ID, parent span ID, span start timestamp) to durable storage. On resume, the worker rehydrated the context and continued. T...",
    "condition_of_validity": "The invariant that must hold for `gen_ai.usage.*` attributes to be authoritative for cost is: > **For every span carrying `gen_ai.usage.*`, exactly one model invocation occurred, the span was opened and closed by the same process instance that observed that invocation's request and response, and the span's end timestamp is causally after the response was rec...",
    "decision_boundary": "An instance must treat `gen_ai.usage.*` as **non-authoritative for cost** and route to a reconciliation path when any of the following holds at span-close time: - The span context was rehydrated from durable storage (resume path) rather than opened in-process. Detect via a `resumed=true` marker written at rehydration, or by comparing span start timestamp aga...",
    "operational_effect": "Downstream consumers of these spans — cost dashboards, budget enforcers, per-tenant billing — inherit the defect silently. A budget enforcer that halts an agent when cumulative `gen_ai.usage.input_tokens` crosses a threshold will halt *early* on replayed traces (duplication) and *late* on cross-worker-resumed traces (truncation), with the direction of error ..."
  },
  "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": "29cfba733fb6649ea84c820ee53a7641327a9e46f071c300a480ea63b3a500c1",
    "verified_classes": [
      "SpanProvenanceError",
      "GenAISpan",
      "SpanProcessor"
    ],
    "verified_functions": [
      "reconcile_cost",
      "close_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SpanProvenanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
