{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-orphaned-tool-call-spans-when-opentelemetry-genai-semantic-conventions-lose-parent-linkage-across-a-mid-task-checkpoi",
  "title": "How should an instance reconcile orphaned tool-call spans when OpenTelemetry GenAI semantic conventions lose parent linkage across a mid-task checkpoint resume",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents that emit OTel GenAI spans (`gen_ai.operation.name`, `gen_ai.tool.call.id`) around tool invocations and resume execution from a persisted checkpoint (durable-state graph, queue replay, or process restart). Does not cover pure in-process synchronous tool loops where the span tree never leaves memory, nor does it cover span export transport failures.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-orphaned-tool-call-spans-when-opentelemetry-genai-semantic-conventions-lose-parent-linkage-across-a-mid-task-checkpoi.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-orphaned-tool-call-spans-when-opentelemetry-genai-semantic-conventions-lose-parent-linkage-across-a-mid-task-checkpoi.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-orphaned-tool-call-spans-when-opentelemetry-genai-semantic-conventions-lose-parent-linkage-across-a-mid-task-checkpoi.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1714,
    "python_slice_tokens": 310,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions model a tool call as a **child span** of the agent invocation span, correlated to the model's request by `gen_ai.tool.call.id` and to the parent by W3C `trace_id`/`span_id`. This is a *trace-tree* invariant: every `execute_tool` span must have a live parent span in the same trace at export time. Checkpoint-resume breaks a diffe...",
    "what_was_observed": "A durable agent (LangGraph-style checkpointer, tool calls dispatched to a sandbox) was instrumented per convention. Task: 14-step investigation with 9 tool calls. A checkpoint fired between tool call #5 and #6, the worker was preempted, and a new worker resumed from the checkpoint. Forensic reconstruction of the exported spans: - Spans 1–5 (`execute_tool`) carry `trace_id=T`, parent `span_id=S_agent_1`. Correct. - Th...",
    "condition_of_validity": "The reconciliation rule below is valid **only if** the checkpoint schema is extended to persist a serialized `SpanContext` (trace_id, span_id, trace_flags, trace_state) plus the `gen_ai.tool.call.id` and the tool schema version hash at the moment of suspension. If the checkpoint cannot carry `SpanContext`, the correct behavior is **not** to reconcile but to ...",
    "decision_boundary": "The boundary is: **does the resumed process hold a reconstructable parent `SpanContext` for the pending tool call?** - **Yes (SpanContext persisted):** re-emit the parent agent span as a *resumed* span with the same `span_id` and `trace_id`, set `gen_ai.operation.name=invoke_agent`, and attach the pending tool call as its child. The tool-call DAG stays conne...",
    "operational_effect": "Consequences an operator must plan for: 1. **Auditor false positives/negatives.** Graph-based integrity checks that assume single-rooted traces will either reject valid resumes or accept unverified tool executions. The check must be `root_count == 1 OR all extra roots carry agent.resume.count > 0 AND a link to the prior root`. 2. **Cost attribution drift.** ..."
  },
  "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": "34cce02ccf36eaee02789206d23aa6c078cae78b03d34023d39ce7cc79e562e3",
    "verified_classes": [
      "OrphanedToolSpanError",
      "SpanContext",
      "ToolSpan",
      "Checkpoint"
    ],
    "verified_functions": [
      "reconcile_resumed_tool_span",
      "validate_trace_invariant"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "OrphanedToolSpanError"
    ],
    "sample_fail_closed_invariants": [
      "resumed worker inherited trace_id without parent span_id; this creates a structurally-valid but semantically orphaned to"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
