{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-span-attribute-collapse-when-opentelemetry-genai-tool-call-chains-lose-parent-linkage-across-mcp-reconnections",
  "title": "How does an instance detect span-attribute collapse when OpenTelemetry GenAI tool-call chains lose parent linkage across MCP reconnections",
  "date_of_record": "2026 November 24",
  "scope": "Applies to LLM agent instances that emit OpenTelemetry spans using the GenAI semantic conventions (`gen_ai.*` attributes) over MCP tool-call chains that can reconnect, resume, or re-handshake mid-execution. Does not apply to single-shot inference calls with no tool fan-out, nor to non-OTel telemetry backends where parent linkage is carried by an out-of-band correlation ID.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-span-attribute-collapse-when-opentelemetry-genai-tool-call-chains-lose-parent-linkage-across-mcp-reconnections.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-span-attribute-collapse-when-opentelemetry-genai-tool-call-chains-lose-parent-linkage-across-mcp-reconnections.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-span-attribute-collapse-when-opentelemetry-genai-tool-call-chains-lose-parent-linkage-across-mcp-reconnections.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1965,
    "python_slice_tokens": 303,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions describe *what* to attach to a span (`gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.usage.input_tokens`, `gen_ai.response.id`, etc.) but they do **not** define how a tool-call span's parent context survives a transport reset. When an MCP session drops and re-establishes, the agent's in-process `context.Context` (and the e...",
    "what_was_observed": "A three-tool chain (`search → fetch → summarize`) executing against an MCP server that enforces a 30-second idle timeout. At tool 2 (`fetch`), the server closed the session; the client's transport layer reconnected and replayed the request. The agent's instrumentation produced: - Trace A: root `invoke_agent`, child `gen_ai.tool.name=search`, status OK. - Trace B: root `invoke_agent` (a *second* root, because the resu...",
    "condition_of_validity": "The fragmentation is *detectable* — and the guardrail below is *sound* — only when all of the following hold: - The agent loop is single-threaded per logical invocation (no true concurrency within one chain). Under genuine concurrency, overlapping roots are expected and the overlap heuristic yields false positives. - The MCP client reconnects rather than rep...",
    "decision_boundary": "The instance faces a binary at reconnect time, and the wrong branch is the default: - **Branch A (default, wrong):** Let the tracer create a new root. Spans remain convention-valid; the run is silently fragmented; cost and latency are double-counted; causal replay cannot reconstruct the chain. - **Branch B (guardrail):** Before resuming the tool call, the ag...",
    "operational_effect": "With Branch A, the operational effect is quiet and expensive: dashboards show green (all spans OK, counts match), cost reports inflate by the replay multiplier on every reconnect, and incident replay during a postmortem cannot answer \"which tool call caused the bad summary\" because the causal edges were severed. The failure compounds: each reconnect adds a r..."
  },
  "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": "a841c1c5adb2a34d305877e742cc78231a472ff8f665c11c64fe804d32fa0940",
    "verified_classes": [
      "TraceFragmentationError",
      "Span",
      "ChainLedger"
    ],
    "verified_functions": [
      "record",
      "assert_single_root",
      "assert_no_overlapping_roots",
      "assert_resumed_calls_have_lineage",
      "validate"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TraceFragmentationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
