{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-reject-an-opentelemetry-genai-span-tree-when-token-cost-attributes-disagree-with-the-tool-call-event-ledger",
  "title": "In what scenarios must an instance reject an OpenTelemetry GenAI span tree when token/cost attributes disagree with the tool-call event ledger",
  "date_of_record": "2026 November 21",
  "scope": "Applies to any agent runtime that emits OpenTelemetry GenAI spans (`gen_ai.*` attributes) per the semantic conventions and reconciles them against an out-of-band tool-call event ledger for billing, replay, or audit. Does not apply to runtimes that treat spans as purely observational telemetry with no downstream cost or replay authority.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-an-opentelemetry-genai-span-tree-when-token-cost-attributes-disagree-with-the-tool-call-event-ledger.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-an-opentelemetry-genai-span-tree-when-token-cost-attributes-disagree-with-the-tool-call-event-ledger.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-an-opentelemetry-genai-span-tree-when-token-cost-attributes-disagree-with-the-tool-call-event-ledger.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1711,
    "python_slice_tokens": 259,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define two *independent* accounting surfaces that are never required to agree: the **span attribute surface** (`gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.operation.name`, `gen_ai.tool.name`, nested under a parent `invoke_agent` span) and the **event surface** (span events / log records of type `gen_ai.to...",
    "what_was_observed": "A research agent running a `invoke_agent` span with `gen_ai.operation.name=\"invoke_agent\"` and `gen_ai.agent.name=\"researcher-v3\"` executed a plan of tool calls against a search API and a code interpreter. The span tree, as exported: - Parent `invoke_agent` span: `gen_ai.usage.input_tokens=18,940`, `gen_ai.usage.output_tokens=4,201`. - Child `execute_tool` spans: 11, of which 3 were retries of the same `gen_ai.tool.n...",
    "condition_of_validity": "The reconciliation invariant holds only under all of the following: 1. **Call-identity stability across retries.** The runtime must propagate a single logical `gen_ai.tool.call.id` through every retry attempt (typically by minting the id before the first attempt and reusing it, recording attempt count in a separate `retry.attempt` attribute). If the id is re...",
    "decision_boundary": "The instance must **reject** the trace for cost/replay authority — raising rather than quarantining-and-proceeding — when: - `count(distinct gen_ai.tool.call.id)` exceeds the number of distinct `(gen_ai.tool.name, normalized_arguments_hash)` pairs by more than the recorded retry count, indicating either id instability or event/span duplication that the dedup...",
    "operational_effect": "Rejecting on these boundaries converts a silent billing error into a loud, attributable failure at trace-ingest time, before the ledger is written. The practical consequence is that the agent runtime is forced to mint call ids *before* the first attempt and to emit exactly one authoritative representation per call — a small change to the SDK's span-emission ..."
  },
  "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": "3693c83cb02e5ac06cce7291ff37abcf77f3383e260ba4b51ad0074d1ed28b11",
    "verified_classes": [
      "GenAiSpanReconciliationError",
      "ToolCallRecord",
      "AgentSpanSummary"
    ],
    "verified_functions": [
      "assert_reconcilable"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "GenAiSpanReconciliationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
