{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-reconcile-opentelemetry-genai-token-accounting-spans-against-the-divergent-tool-call-event-stream-before-committing",
  "title": "In what scenarios must an instance reconcile OpenTelemetry GenAI token-accounting spans against the divergent tool-call event stream before committing a checkpoint",
  "date_of_record": "2026 November 30",
  "scope": "Applies to any agent runtime that emits OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) for LLM invocations and tool calls, and that uses the emitted span tree as the durable source of truth for checkpoint/resume or cost reconciliation. Does not apply to runtimes that treat telemetry as write-only observability with no read-back into agent state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reconcile-opentelemetry-genai-token-accounting-spans-against-the-divergent-tool-call-event-stream-before-committing.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reconcile-opentelemetry-genai-token-accounting-spans-against-the-divergent-tool-call-event-stream-before-committing.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reconcile-opentelemetry-genai-token-accounting-spans-against-the-divergent-tool-call-event-stream-before-committing.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1902,
    "python_slice_tokens": 341,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The OpenTelemetry GenAI conventions model an agent turn as a parent span (`invoke_agent` / `chat`) with child spans for each LLM call (`gen_ai.operation.name = chat`) and each tool invocation (`gen_ai.operation.name = execute_tool`), where token usage is recorded as attributes on the *chat* span (`gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`) and...",
    "what_was_observed": "A multi-tool agent executing a plan with three parallel tool calls per turn (a common fan-out pattern: `search`, `fetch`, `summarize`) was observed to produce, on resume from checkpoint, a reconstructed conversation history that contained **two** tool results where the model had actually generated **three** tool-call tokens. The trace showed a parent `invoke_agent` span with `gen_ai.usage.output_tokens = 412` and exa...",
    "condition_of_validity": "The reconciliation guard described here is **required** when all of the following hold: - The agent fans out to more than one tool per model turn (concurrency > 1), OR any single tool is LLM-backed and can outlive the dispatch block. - The span tree is read back as durable state (checkpoint/resume, cost attribution, or replay) rather than consumed only by a ...",
    "decision_boundary": "The boundary is drawn at **span finalization vs. tool completion ordering**. A tool-call event is only trustworthy as a record of model output if it was appended to a span that had not yet been ended at append time, *and* if the span's usage attributes were set from the same model response that generated the tool-call tokens. The reconciliation rule is: - Co...",
    "operational_effect": "Without the guard, the agent exhibits a specific, reproducible pathology: **silent history truncation with intact billing**. The model's next turn reasons over a history that is internally inconsistent (it \"remembers\" issuing N calls but sees N−k results), which manifests as either redundant re-issuance of the missing tool call (cost amplification) or, worse..."
  },
  "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": "ff1a4209aefc1f71caa161c871b98cea2b893320cfbb7e9ee9fb2c7997efae83",
    "verified_classes": [
      "SpanReconciliationError"
    ],
    "verified_functions": [
      "reconcile_turn_before_checkpoint"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpanReconciliationError"
    ],
    "sample_fail_closed_invariants": [
      "Non-zero tool calls but zero output tokens recorded; usage attribute was likely set before the model response finalized."
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
