{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-reject-opentelemetry-genai-span-parenting-when-a-tool-call-child-span-s-gen-ai-tool-call-id-does-not-resolve-to-a-p",
  "title": "In what scenarios must an instance reject OpenTelemetry GenAI span parenting when a tool-call child span's `gen_ai.tool.call.id` does not resolve to a parent `gen_ai.operation.name=execute_tool` span within the same trace?",
  "date_of_record": "2026 November 20",
  "scope": "Applies to any agent runtime emitting OTel GenAI semantic-convention spans where tool invocations are modeled as child spans of an `invoke_agent`/`chat` span and correlated back to tool results by `gen_ai.tool.call.id`. Does not apply to single-shot LLM calls with no tool loop, nor to runtimes that serialize tool calls inline within the parent span's attributes rather than as discrete spans.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-span-parenting-when-a-tool-call-child-span-s-gen-ai-tool-call-id-does-not-resolve-to-a-p.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-span-parenting-when-a-tool-call-child-span-s-gen-ai-tool-call-id-does-not-resolve-to-a-p.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-span-parenting-when-a-tool-call-child-span-s-gen-ai-tool-call-id-does-not-resolve-to-a-p.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1972,
    "python_slice_tokens": 348,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat `gen_ai.tool.call.id` as a *correlation key* — the same value must appear on the tool-invocation span (emitted when the model requests the call) and on the tool-result span (emitted when execution returns). This is distinct from the W3C `trace_id`/`span_id`/`parent_span_id` linkage, which is *structural*. The failure mode...",
    "what_was_observed": "A tool-calling agent (ReAct-style loop, 4 tools, checkpointing every step to a durable log) resumed mid-task after a host migration. The checkpoint captured the LLM's `tool_calls` array — including `id: \"call_8f3a\"` — but the resume path constructed a *new* OTel `Tracer.start_as_current_span(\"execute_tool\", ...)` context rather than re-attaching the persisted `SpanContext`. The persisted `SpanContext` had a `trace_id...",
    "condition_of_validity": "The correlation-by-call-id model is only sound under three jointly-held conditions: 1. **Trace continuity across checkpoint/resume.** The persisted `SpanContext` (trace id, span id, trace flags, and `tracestate`) must be re-attached via `trace.set_span_in_context` before the resumed `execute_tool` span is started. If the runtime cannot guarantee this — e.g.,...",
    "decision_boundary": "An instance must **reject** the span (raise, do not emit) when any of the following holds at `execute_tool` span creation: - The call id resolves to an `execute_tool` span whose `trace_id` differs from the current active span's `trace_id`, **and** no `gen_ai.tool.call.id.reassigned` attribute is set. (Cross-trace join — the migration case.) - A second `execu...",
    "operational_effect": "Downstream consumers must be told which regime they are in. A backend that computes tool error rate by joining `gen_ai.tool.call.id` across traces will, under the violation, report rates >100% and attribute failures to the wrong tool. A backend that computes p99 tool latency by `parent_span_id` traversal will, under the parenting violation, attribute agent r..."
  },
  "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": "02f5b6e6ac45e8d39bda70fc450090eb29a9bc905da9ac6e69be0421cf456da0",
    "verified_classes": [
      "ToolCallSpanParentingError",
      "SpanRef",
      "ToolSpanRegistry"
    ],
    "verified_functions": [
      "__init__",
      "register",
      "close"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ToolCallSpanParentingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
