{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-reconcile-opentelemetry-genai-span-attributes-against-the-actual-token-ledger-when-a-tool-call-event-stream-is-trun",
  "title": "In what scenarios must an instance reconcile OpenTelemetry GenAI span attributes against the actual token ledger when a tool-call event stream is truncated mid-invocation",
  "date_of_record": "2026 November 23",
  "scope": "Applies to agent runtimes that emit OpenTelemetry GenAI semantic conventions (`gen_ai.*`) for model invocations and tool calls, where spans and events are exported asynchronously and may be dropped or truncated. Does not apply to synchronous, in-process tracing with guaranteed delivery or to non-agent single-shot inference without tool loops.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reconcile-opentelemetry-genai-span-attributes-against-the-actual-token-ledger-when-a-tool-call-event-stream-is-trun.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reconcile-opentelemetry-genai-span-attributes-against-the-actual-token-ledger-when-a-tool-call-event-stream-is-trun.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reconcile-opentelemetry-genai-span-attributes-against-the-actual-token-ledger-when-a-tool-call-event-stream-is-trun.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1514,
    "python_slice_tokens": 247,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat a model invocation as a span bearing `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`, and treat each tool call as either a child span or an event (`gen_ai.tool.name`, `gen_ai.tool.call.id`) attached to the invocation. The convention assumes these are *descriptive* attributes: they record what happened. But ag...",
    "what_was_observed": "An agent executing a five-step tool loop (search → fetch → parse → validate → summarize) emits one `gen_ai.chat` span per model turn and one event per tool call, each event carrying `gen_ai.tool.name` and a per-call `gen_ai.usage.input_tokens` fragment for the tool's result re-injection. The OTLP exporter has a `max_queue_size` and a batch timeout. Under load, the batch containing events 4 and 5 is dropped after the ...",
    "condition_of_validity": "The reconciliation requirement is valid — and the guardrail is mandatory — precisely when all three hold: 1. The runtime derives any budget, checkpoint, or resume decision from exported `gen_ai.*` attributes rather than from its own ledger. 2. Tool-call events are exported through an at-most-once channel (OTLP batch, fire-and-forget span processor) with no s...",
    "decision_boundary": "The boundary is whether the runtime can *prove* the event stream is complete before using it. The convention provides no completeness marker, so completeness must be inferred. The safe inference is: an invocation span is complete-as-projection only if the count of observed tool-call events equals an independently recorded expected count. If no such count exi...",
    "operational_effect": "Enforcing this invariant changes resume semantics from optimistic to conservative. A resumed task that cannot reconcile its telemetry projection against a ledger now halts and re-plans from the last *ledgered* checkpoint rather than continuing from a truncated event tail. The cost is occasional redundant re-execution of a turn; the benefit is that context-bu..."
  },
  "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": "d7a70b09e2d9cde1ef1c4f9ec8806a6b32b58037975a6cbfa8ccfbac8c6a23b7",
    "verified_classes": [
      "TelemetryReconciliationError"
    ],
    "verified_functions": [
      "reconcile_invocation"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TelemetryReconciliationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
