{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-fork-span-lineage-when-a-tool-call-child-span-outlives-its-parent-turn-in-opentelemetry-genai-traces",
  "title": "Under what conditions must an instance fork span lineage when a tool-call child span outlives its parent turn in OpenTelemetry GenAI traces",
  "date_of_record": "2026 November 26",
  "scope": "Applies to agent runtimes that emit OpenTelemetry spans using the GenAI semantic conventions (`gen_ai.*`) across multi-turn conversations where tool-call spans may complete after the enclosing turn span has ended. Does not apply to single-shot RPC tracing, nor to runtimes that serialize all tool execution synchronously within the parent turn's lifetime.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-fork-span-lineage-when-a-tool-call-child-span-outlives-its-parent-turn-in-opentelemetry-genai-traces.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-fork-span-lineage-when-a-tool-call-child-span-outlives-its-parent-turn-in-opentelemetry-genai-traces.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-fork-span-lineage-when-a-tool-call-child-span-outlives-its-parent-turn-in-opentelemetry-genai-traces.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2234,
    "python_slice_tokens": 338,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions model a conversation as a nested tree: a `gen_ai.chat` (or `gen_ai.invoke_agent`) span per turn, with `gen_ai.execute_tool` child spans carrying `gen_ai.tool.name` and `gen_ai.tool.call.id`. The convention assumes a *containment* invariant: every tool span's `end_time` precedes its parent turn's `end_time`, so the parent can be...",
    "what_was_observed": "A multi-turn agent (turn span `T1`, `span_id=0xA`, `end_time=t=100ms`) issued a tool call `gen_ai.execute_tool` (`span_id=0xB`) for a `bash` invocation. The tool ran for 4.2s. At `t=4300ms` the span closed. The runtime set `parent_span_id=0xA` per convention, because the tool call *originated* in turn `T1`. Three downstream effects, all observed: 1. **The OTLP collector accepted the span but the backend dropped it fr...",
    "condition_of_validity": "The containment invariant holds — and the naive parentage is correct — if and only if the following three conditions all hold at the moment the tool span is emitted: - **C1 (temporal containment):** `tool_span.end_time <= parent_turn_span.end_time`. If the tool outlives the turn, containment is violated. - **C2 (parent liveness at export):** the parent span ...",
    "decision_boundary": "The runtime must branch on a single predicate evaluated at tool-span emission time: If `fork_required` is false, emit with `parent_span_id = turn_span_id` (convention-faithful). If true, emit with `parent_span_id = continuation_span_id` and attach a `SpanLink` to the originating turn, plus a `gen_ai.tool.call.id` attribute that is *stable across retries* (th...",
    "operational_effect": "Forking changes the trace's shape and its consumers: - **Trace waterfall:** the fork span becomes a sibling of the turn span under the trace root, not a child. The waterfall shows `T1`, then a continuation span `T1'` at `t=4300ms` carrying the tool result. The critical path is now correct (the tool's 4.2s is visible), but the visual nesting no longer matches..."
  },
  "matched_failure_symptoms": [
    "SUBPROCESS_PIPE_HANG_OR_FD_LEAK"
  ],
  "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": "7db765beeb58a041601c3b53994dae13aae99eaa6f1413435108713b479a6523",
    "verified_classes": [
      "LineageForkError",
      "Span"
    ],
    "verified_functions": [
      "emit_tool_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "LineageForkError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
