{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-halt-when-opentelemetry-genai-span-attributes-disagree-with-the-tool-call-ledger-it-claims-to-describe",
  "title": "Where must an instance halt when OpenTelemetry GenAI span attributes disagree with the tool-call ledger it claims to describe?",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agents that emit OpenTelemetry spans conforming to the GenAI semantic conventions (`gen_ai.*` attributes) around tool invocations, and whose downstream auditors or cost controllers reconcile those spans against an internal tool-call ledger. Does not apply to pure tracing of non-agent LLM completions, nor to systems where the span is the sole source of truth with no independent ledger.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-halt-when-opentelemetry-genai-span-attributes-disagree-with-the-tool-call-ledger-it-claims-to-describe.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-halt-when-opentelemetry-genai-span-attributes-disagree-with-the-tool-call-ledger-it-claims-to-describe.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-halt-when-opentelemetry-genai-span-attributes-disagree-with-the-tool-call-ledger-it-claims-to-describe.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1946,
    "python_slice_tokens": 348,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat a span as a *descriptive observation*: `gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.response.finish_reasons`, and the tool-call arguments are recorded as attributes on a span that is emitted *after* the operation resolves. The agent's tool-call ledger trea...",
    "what_was_observed": "A tool-calling agent invoked a `search_documents` tool. The provider returned a response with `finish_reason: \"tool_calls\"` and reported `usage.output_tokens = 412`. The runtime executed the tool, but the tool returned a payload exceeding the tool-result budget, so the runtime truncated the result and *re-issued the same logical step* with a compacted history. On the second attempt the model produced a shorter tool-c...",
    "condition_of_validity": "The invariant that would make span-derived accounting safe is: *for every logical tool call, exactly one span carries the authoritative usage and side-effect record, and every other span is marked as a subordinate attempt with a back-reference.* The GenAI conventions do not define an attempt/retry attribute, so this invariant is only valid when the instrumen...",
    "decision_boundary": "An instance must halt reconciliation and refuse to derive cost, side-effect, or replay state from spans when: - Two or more spans share `gen_ai.tool.name` and `gen_ai.operation.name` within a single logical step's time window but carry no shared `gen_ai.tool.call.id` and no parent-child relation. This is the ambiguous-retry case; treating it as either one ca...",
    "operational_effect": "The practical consequence is that GenAI span attributes are a *reporting* surface and must be treated as untrusted input to any *accounting* or *verification* surface. Agents that conflate them will, under retry and truncation conditions, either double-charge a budget (counting each attempt as a logical call) or under-charge it (taking only the terminal atte..."
  },
  "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": "126551815bae2b50d701fbd235af11dcda136fd7027b8d7c388c8f2035d84254",
    "verified_classes": [
      "SpanLedgerDivergence",
      "ToolSpan",
      "LedgerEntry"
    ],
    "verified_functions": [
      "reconcile_step"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SpanLedgerDivergence"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
