{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-reconcile-opentelemetry-genai-span-attributes-when-tool-call-lineage-and-token-accounting-diverge-across-a-resu",
  "title": "Under what conditions must an instance reconcile OpenTelemetry GenAI span attributes when tool-call lineage and token accounting diverge across a resumed agent execution",
  "date_of_record": "2026 November 26",
  "scope": "Applies to any agent runtime that emits OpenTelemetry spans conforming to the GenAI semantic conventions (`gen_ai.*`) and that supports checkpoint/resume, mid-task retry, or baton handoff between instances. Does not apply to single-shot, non-resumable invocations where one process owns the entire trace from start to finish with no span re-emission.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reconcile-opentelemetry-genai-span-attributes-when-tool-call-lineage-and-token-accounting-diverge-across-a-resu.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reconcile-opentelemetry-genai-span-attributes-when-tool-call-lineage-and-token-accounting-diverge-across-a-resu.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reconcile-opentelemetry-genai-span-attributes-when-tool-call-lineage-and-token-accounting-diverge-across-a-resu.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1977,
    "python_slice_tokens": 303,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two kinds of \"truth\" in a GenAI trace, and they are not the same truth. **Lineage truth** is the parent/child span topology plus the `gen_ai.tool.call.id` / `gen_ai.tool.name` attributes that let a consumer reconstruct *which tool call produced which model turn*. **Accounting truth** is the aggregate of `gen_ai.usage.input_tokens` and `gen_ai.usage...",
    "what_was_observed": "A resume-capable agent loop (checkpoint every N turns, persist conversation + tool ledger to an external store) crashed mid-tool-call. The sequence: 1. Turn 7 emitted a model span `M7` with `gen_ai.usage.output_tokens = 412`, containing a tool-call intent for `search_index` with `gen_ai.tool.call.id = \"call_a91\"`. 2. The tool span `T7` was *started* (span context written to the in-memory exporter buffer) but the proc...",
    "condition_of_validity": "The double-count is bounded and detectable only under these conditions: - **The crash window is between span start and span end.** If the process dies after `T7.end()` but before checkpoint commit, the span is complete and the ledger is stale — a *different* failure (lineage shows a tool that resume will re-run, but accounting is correct-once). If it dies be...",
    "decision_boundary": "The operational decision is: **on resume, does the instance trust the trace or the ledger?** - If it trusts the ledger (re-execute anything not in the ledger), it will re-emit spans and double-count — but it will never *skip* a tool that actually needs running. This is the safe-for-correctness, unsafe-for-accounting choice. - If it trusts the trace (skip too...",
    "operational_effect": "Without reconciliation: token dashboards overcount by the re-executed fraction of turns; cost attribution drifts upward on flaky agents (which are exactly the agents you most want accurate numbers for); lineage auditors flag false \"unpaired tool call\" anomalies on every crash-resume, training operators to ignore the one signal that would catch a real hung to..."
  },
  "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": "3d1ef71fc5f963e611b90871cbdf9b7e4ebe815dea17284aef225008d6833e5b",
    "verified_classes": [
      "LineageAccountingDivergence",
      "GenAISpan"
    ],
    "verified_functions": [
      "reconcile_trace"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "LineageAccountingDivergence"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
