{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-span-attribute-lineage-collapse-when-genai-semantic-conventions-meet-multi-turn-tool-call-fan-out",
  "title": "What structural signals indicate span-attribute lineage collapse when GenAI semantic conventions meet multi-turn tool-call fan-out",
  "date_of_record": "2026 November 29",
  "scope": "Applies to OpenTelemetry-instrumented agent runtimes that emit `gen_ai.*` span attributes across multi-turn tool-call loops and reconcile token counts per span. Does not cover single-shot inference spans, non-instrumented agents, or billing reconciliation against provider invoices.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-span-attribute-lineage-collapse-when-genai-semantic-conventions-meet-multi-turn-tool-call-fan-out.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-span-attribute-lineage-collapse-when-genai-semantic-conventions-meet-multi-turn-tool-call-fan-out.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-span-attribute-lineage-collapse-when-genai-semantic-conventions-meet-multi-turn-tool-call-fan-out.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1579,
    "python_slice_tokens": 400,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat a span as the atomic unit of a model interaction: one `gen_ai.chat` or `gen_ai.tool` span carries `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens` for *that* call. Multi-turn agent loops, however, are not atomic. A single logical \"turn\" fans out into N tool-call spans, each of which re-sends a growing conversa...",
    "what_was_observed": "A three-turn agent loop with two tool calls per turn produced seven spans: three `gen_ai.chat` spans and four `gen_ai.tool` spans (turn 3 resolved without a second tool call). Each chat span reported `input_tokens` equal to the full accumulated context: 1,200 → 3,400 → 6,100. Summing `input_tokens` across the three chat spans yielded 10,700. The provider's actual billed input was 6,100—the final prefix only, since pr...",
    "condition_of_validity": "The additive-accounting interpretation holds only when each span's input is disjoint from every other span's input. That condition is satisfied for: - Independent, non-chained inferences (batch classification, parallel sampling). - Single-turn tool calls where the tool span carries no `gen_ai.usage` attributes of its own. It is violated whenever a span's inp...",
    "decision_boundary": "The boundary between \"safe to sum\" and \"must take max\" is crossed at the first tool-call fan-out within a turn. Concretely: - **Sum** `input_tokens` only across spans that are siblings in time (concurrent) or provably disjoint (different `gen_ai.request.model` sessions, different conversation IDs). - **Take max** `input_tokens` across chained `gen_ai.chat` s...",
    "operational_effect": "Instrumentation that ignores this boundary produces three predictable regressions: cost over-reporting proportional to turn depth (roughly O(N²) in tokens for N turns of linear growth), premature context-budget truncation, and lineage graphs that misattribute tool-call causality because sibling-flat topology hides the sequential dependency. The corrective is..."
  },
  "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": "4997469e97b187b76591bf2be7d3c753376c5106c0452c6e2691a1d8d8745e58",
    "verified_classes": [
      "LineageCollapseError",
      "GenAISpan"
    ],
    "verified_functions": [
      "reconcile_turn_tokens",
      "guard_context_budget"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "LineageCollapseError"
    ],
    "sample_fail_closed_invariants": [
      "no gen_ai.chat spans present; cannot reconcile",
      "reconciliation produced no turn occupancy",
      "chained gen_ai.chat spans show monotonic prefix growth but carry no gen_ai.conversation.turn_index; sum-vs-max is ambigu"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
