{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-emits-opentelemetry-genai-spans-for-a-tool-call-that-never-returns-attribute-truncation-orphaned-token-counts-and-the-tr",
  "title": "What happens when an instance emits OpenTelemetry GenAI spans for a tool call that never returns: attribute truncation, orphaned token counts, and the trace-context invariant that bounds agent observability",
  "date_of_record": "2026 November 19",
  "scope": "Applies to LLM agents instrumented with OpenTelemetry GenAI semantic conventions (`gen_ai.*`) where tool invocations, token accounting, and span lifecycle are emitted from within the agent process. Does not apply to proxy-side or gateway-side instrumentation that observes traffic out-of-process, nor to batch/offline evaluation harnesses that reconstruct spans post-hoc.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-opentelemetry-genai-spans-for-a-tool-call-that-never-returns-attribute-truncation-orphaned-token-counts-and-the-tr.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-opentelemetry-genai-spans-for-a-tool-call-that-never-returns-attribute-truncation-orphaned-token-counts-and-the-tr.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-opentelemetry-genai-spans-for-a-tool-call-that-never-returns-attribute-truncation-orphaned-token-counts-and-the-tr.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2551,
    "python_slice_tokens": 513,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat a span as a *record of a completed operation*: `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, and tool-call attributes like `gen_ai.tool.name` and `gen_ai.tool.call.id` are specified as attributes on spans that **end**. The convention is silent—deliberately—on the case where the operation is a *tool call dispa...",
    "what_was_observed": "An agent loop with three tool calls per turn, instrumented per the GenAI conventions: - One `gen_ai.chat` span per LLM invocation, with `gen_ai.usage.input_tokens` / `output_tokens` set at `end()`. - One `gen_ai.tool` child span per tool dispatch, with `gen_ai.tool.name`, `gen_ai.tool.call.id`, and a `gen_ai.tool.call.arguments` string attribute. - Trace context propagated via W3C `traceparent` into the tool executor...",
    "condition_of_validity": "The GenAI conventions are valid as an observability substrate for an agent **iff** the following holds: > For every `gen_ai.tool` span with `status=OK` in trace `T`, there exists a subsequent `gen_ai.chat` span in `T` whose input token count was computed over a prompt that includes that tool's output, and the mapping from tool span to chat span is recoverabl...",
    "decision_boundary": "The boundary is not \"should we instrument tool calls\" — we must. It is **where the token-to-tool join is materialized**, and the decision is forced by a single question: > *Is the tool call's cost knowable at the moment the tool span ends?* - **No** (the default for agent loops): the tool span must **not** be the accounting record. Emit the tool span for lat...",
    "operational_effect": "Adopting the boundary changes three operational facts: 1. **Cost attribution becomes turn-scoped, not call-scoped, unless the partition attribute is emitted.** Teams that join tool spans to chat spans by `call.id` will systematically under-attribute cost to retried calls and over-attribute to the turn aggregate. The error is bounded by the retry rate; at a 1..."
  },
  "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": "d74a0e8cc449e856d9b93e073c02cdc583575f539cd90125b1013040e0bce9a8",
    "verified_classes": [
      "GenAITraceInvariantError",
      "ToolDisposition",
      "ToolSpan",
      "ChatSpan",
      "Trace"
    ],
    "verified_functions": [
      "finalize_turn"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "GenAITraceInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
