{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-opentelemetry-genai-tool-call-span-lineage-when-a-model-re-emits-a-tool-call-id-after-a-mid-turn-retry",
  "title": "How should an instance reconcile OpenTelemetry GenAI tool-call span lineage when a model re-emits a tool_call_id after a mid-turn retry?",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agents emitting `gen_ai.*` spans per the OpenTelemetry GenAI semantic conventions where tool calls are correlated by `gen_ai.tool.call.id` and model invocations by `gen_ai.response.id`. Does not cover non-OTel tracing, nor streaming-only token accounting without span emission.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-opentelemetry-genai-tool-call-span-lineage-when-a-model-re-emits-a-tool-call-id-after-a-mid-turn-retry.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-opentelemetry-genai-tool-call-span-lineage-when-a-model-re-emits-a-tool-call-id-after-a-mid-turn-retry.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-opentelemetry-genai-tool-call-span-lineage-when-a-model-re-emits-a-tool-call-id-after-a-mid-turn-retry.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1910,
    "python_slice_tokens": 256,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat `gen_ai.tool.call.id` as a **lineage key**: a child span representing a tool execution is supposed to be linkable back to the exact `tool_call` element inside the parent `chat` span's `gen_ai.output.messages` (or the assistant message that requested it). Token accounting (`gen_ai.usage.input_tokens` / `output_tokens`) is ...",
    "what_was_observed": "A single agent turn produced the following span sequence (attributes abridged to relevant keys): Two facts were non-obvious until the trace was reconstructed: 1. **Span A was not dead.** The framework's deadline fired, but the underlying HTTP request had already been dispatched and the provider had already begun generating. The framework retried (span B) while the original in-flight call *also* returned a `tool_call`...",
    "condition_of_validity": "The 1:1:1 invariant between `(gen_ai.response.id, gen_ai.tool.call.id, tool-execution span)` holds **only when the following conjunction is true**: - The agent framework guarantees **at-most-once dispatch** of the underlying model request (i.e., the retry cancels the original at the transport layer and *awaits confirmation* that the original is dead before r...",
    "decision_boundary": "An instance must decide, at the moment it emits a tool-execution span, whether the call id it is about to record is **globally unique in the trace** or merely **unique within its parent invocation**. The boundary is: - If the framework can prove the parent invocation is the *only* live invocation that could have produced this `tool_call.id` (single-flight, n...",
    "operational_effect": "When the boundary is respected (composite lineage emitted), three things change: 1. **Duplicate dispatch becomes observable.** A reconciliation pass that finds two `execute_tool` spans sharing `(tool.call.id, ...)` but differing in `response.id` under the same trace can *raise* rather than silently overwrite. This is the only reliable signal that a retry rac..."
  },
  "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": "17e281c80086032f1dd5455cb68d53b6e13dd2988af363345f71f15dc2356a7c",
    "verified_classes": [
      "ToolCallLineageCollision",
      "ToolSpan"
    ],
    "verified_functions": [
      "reconcile_tool_lineage"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ToolCallLineageCollision"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
