{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-span-attribute-lineage-collapse-in-opentelemetry-genai-tool-call-chains-under-retry",
  "title": "What structural signals indicate span-attribute lineage collapse in OpenTelemetry GenAI tool-call chains under retry",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agents emitting OpenTelemetry GenAI semantic-convention spans (`gen_ai.operation.name`, `gen_ai.tool.call.id`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`) where tool invocations are retried, replayed, or resumed after checkpoint. Does not apply to single-shot inference spans with no tool lineage, nor to non-OTel telemetry backends that deduplicate by request-id at ingest.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-span-attribute-lineage-collapse-in-opentelemetry-genai-tool-call-chains-under-retry.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-span-attribute-lineage-collapse-in-opentelemetry-genai-tool-call-chains-under-retry.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-span-attribute-lineage-collapse-in-opentelemetry-genai-tool-call-chains-under-retry.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1976,
    "python_slice_tokens": 334,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat `gen_ai.tool.call.id` as an *identity* attribute and `gen_ai.usage.*_tokens` as *cumulative counters scoped to the span*. These two assumptions collide the moment a tool call is retried: the retry is a new span, but the *logical* tool call is the same, and the token usage of the retried attempt is a fresh delta, not a con...",
    "what_was_observed": "A planner agent issued a `search_index` tool call. The tool returned a 503 on the first attempt (span A, `input_tokens=812`, `output_tokens=44`). The agent's retry loop re-issued the identical call with the same `tool.call.id` (span B, `input_tokens=812`, `output_tokens=41`). Span B succeeded. The trace exporter shipped both spans. The downstream cost aggregator, keyed on `gen_ai.tool.call.id`, summed the two spans t...",
    "condition_of_validity": "The invariant that holds is: **`gen_ai.tool.call.id` is a lineage key, not a deduplication key.** It is valid to use it to *group* spans into a logical tool call. It is not valid to use it to *sum* token usage across spans in that group unless each span also carries an explicit `gen_ai.tool.attempt` ordinal and a `gen_ai.tool.lineage.continuation` boolean. W...",
    "decision_boundary": "The boundary is crossed when an agent's tool-call retry policy is decoupled from its span-emission policy. A retry loop that re-invokes the tool without incrementing an attempt counter on the span creates the collapse. The guardrail is architectural, not observational: 1. **Attempt ordinal is mandatory.** Every `execute_tool` span must carry `gen_ai.tool.att...",
    "operational_effect": "The observable effect of lineage collapse is a token ledger that inflates superlinearly with tool failure rate. In a run with a 15% transient tool-failure rate and a 3-attempt retry budget, the naive sum overcounts input tokens by roughly 1.15× to 1.45× depending on retry depth — and the overcount is *correlated with tool flakiness*, so it looks like the age..."
  },
  "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": "9fcb74b1bbc1ce8564253efa237974359587756cee9ae303c77ab2d2fa01e87b",
    "verified_classes": [
      "LineageCollapseError"
    ],
    "verified_functions": [
      "aggregate_tool_usage"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "LineageCollapseError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
