{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-opentelemetry-genai-span-attributes-when-a-single-logical-tool-call-is-retried-across-two-model-invocations-under-one",
  "title": "How should an instance reconcile OpenTelemetry GenAI span attributes when a single logical tool call is retried across two model invocations under one trace",
  "date_of_record": "2026 November 21",
  "scope": "Applies to agent runtimes that emit OTel spans per model invocation and per tool execution, where retries or fallback model swaps occur within a single logical agent step. Does not cover batch/offline evaluation pipelines or spans emitted outside an active agent execution context.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-opentelemetry-genai-span-attributes-when-a-single-logical-tool-call-is-retried-across-two-model-invocations-under-one.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-opentelemetry-genai-span-attributes-when-a-single-logical-tool-call-is-retried-across-two-model-invocations-under-one.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-opentelemetry-genai-span-attributes-when-a-single-logical-tool-call-is-retried-across-two-model-invocations-under-one.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1501,
    "python_slice_tokens": 232,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A *logical tool call* is the agent's intent: \"call `search_docs(query=X)` once.\" A *physical tool invocation* is each attempt the runtime actually performs against the tool endpoint. The GenAI semantic conventions (`gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.request.model`, `gen_ai.response.finish_reasons`, `gen_ai.usage.input_tokens`, `gen_ai.usage...",
    "what_was_observed": "An agent executing a research task invoked `gen_ai.operation.name=\"execute_tool\"` for `search_docs`. The tool returned a 503. The runtime's retry wrapper re-invoked the tool, this time succeeding. Separately, the model invocation that produced the tool call was itself retried after a `finish_reasons=[\"length\"]` truncation, and the second model attempt re-emitted the same `tool_call_id` (the model was told to continue...",
    "condition_of_validity": "The naive mapping (one span per attempt, `gen_ai.tool.call.id` = model-returned ID) is valid only when the runtime guarantees that no logical step produces more than one attempt per operation. That guarantee fails under three conditions, all of which are normal in production: 1. **Transport-level retry** of the tool endpoint (5xx, timeout) — physical retry, ...",
    "decision_boundary": "The architectural decision is whether the runtime **mutates the model-returned call ID** to enforce uniqueness, or **preserves it and adds a disambiguating attribute**. The correct boundary: - **Do not mutate** `gen_ai.tool.call.id` to synthesize uniqueness (e.g., appending `-retry1`). The attribute is specified to carry the model's identifier; downstream sy...",
    "operational_effect": "Without the reconciliation attributes, three downstream effects are observed and are not self-correcting: 1. **Cost overcounting** proportional to retry rate. Truncated model attempts consume real output tokens; summing child `chat` spans charges for discarded content. The parent-span aggregate is the only correct source. 2. **Success-rate distortion.** A 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": "1d3b7e7d449d601e1d20ede2fdc1580b2c4a648f3ea226ca394becb17cb128e6",
    "verified_classes": [
      "SpanReconciliationError",
      "ToolSpan",
      "TraceRegistry"
    ],
    "verified_functions": [
      "register",
      "authoritative"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpanReconciliationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
