{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-drop-tool-call-spans-when-the-genai-semantic-convention-attribute-set-diverges-mid-trace",
  "title": "Why does an instance drop tool-call spans when the GenAI semantic convention attribute set diverges mid-trace",
  "date_of_record": "2026 November 20",
  "scope": "Applies to agents emitting OpenTelemetry spans under the `gen_ai.*` semantic conventions (specifically `gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.usage.*`, `gen_ai.request.model`) across multi-step tool-calling loops where the emitter's convention version, attribute population, or span parentage can change between the first and last tool call in a single logical turn. Does not apply to single-shot completions or to traces emitted by a single statically-configured exporter with a frozen schema.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-drop-tool-call-spans-when-the-genai-semantic-convention-attribute-set-diverges-mid-trace.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-drop-tool-call-spans-when-the-genai-semantic-convention-attribute-set-diverges-mid-trace.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-drop-tool-call-spans-when-the-genai-semantic-convention-attribute-set-diverges-mid-trace.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2332,
    "python_slice_tokens": 438,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a span was not exported.\" The failure is that a *tool-call span was exported but became orphaned or unjoinable* because the attribute set that identifies it diverged from the attribute set its parent or sibling spans were stamped with. OpenTelemetry's GenAI conventions are still marked *experimental*, and the spec has churned `gen_ai.tool...",
    "what_was_observed": "During a replay audit of a 3-tool agent turn (search → fetch → summarize), the collector received 11 spans: 1 root `invoke_agent`, 3 `chat` spans (one per LLM call), 3 `execute_tool` spans, 3 HTTP client spans, 1 finalizer. Span count matched expectation. But the trace-assembly job that reconstructs \"which tool result fed which LLM call\" produced a graph with two disconnected components. Root cause trace: 1. The agen...",
    "condition_of_validity": "The invariant that must hold for a trace to be semantically joinable is: > **For every logical tool invocation in a turn, exactly one span carries `gen_ai.operation.name = \"execute_tool\"` AND a `gen_ai.tool.name` AND a `gen_ai.tool.call.id` that matches the call_id recorded in the agent's own state checkpoint for that step.** This invariant is *only* valid w...",
    "decision_boundary": "The boundary is between **attribute-keyed assembly** and **span-id-keyed assembly with state-side join**. - *Attribute-keyed assembly* (the default in most backends and in naive evaluators) is correct only when the convention version is frozen for the trace's lifetime. It breaks the moment a mid-trace emitter change occurs, and it breaks *quietly*. - *Span-i...",
    "operational_effect": "Without the guardrail, the failure mode propagates in three directions: - **Cost and budget:** token aggregation under-counts when key migration splits `input_tokens`/`prompt_tokens`. An agent's own token-budget guard, if it reads telemetry rather than its local counter, will over-spend because the guard sees less usage than occurred. The budget invariant (\"..."
  },
  "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": "281a0fa53fef0596525f4f45478e3e00df63662db44bfedb6a984460a2325a07",
    "verified_classes": [
      "SpanSemanticJoinError",
      "ToolSpan",
      "AgentCheckpoint"
    ],
    "verified_functions": [
      "audit_tool_chain",
      "_has_usage"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpanSemanticJoinError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
