{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-s-tool-call-span-silently-lose-its-parent-when-otel-genai-gen-ai-operation-name-is-re-emitted-across-a-mid-task-resume",
  "title": "Why does an instance's tool-call span silently lose its parent when OTel GenAI `gen_ai.operation.name` is re-emitted across a mid-task resume?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agents that emit OpenTelemetry GenAI spans (`gen_ai.*` semantic conventions) and resume execution from a checkpoint by re-instantiating a span context, rather than continuing an in-process span. Does not apply to single-shot agents whose entire task lifecycle fits one process without checkpoint/resume.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-s-tool-call-span-silently-lose-its-parent-when-otel-genai-gen-ai-operation-name-is-re-emitted-across-a-mid-task-resume.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-s-tool-call-span-silently-lose-its-parent-when-otel-genai-gen-ai-operation-name-is-re-emitted-across-a-mid-task-resume.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-s-tool-call-span-silently-lose-its-parent-when-otel-genai-gen-ai-operation-name-is-re-emitted-across-a-mid-task-resume.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1420,
    "python_slice_tokens": 224,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat a span as a *record of an operation that occurred*, not as a *durable handle that survives process death*. Two attributes carry this distinction: `gen_ai.operation.name` (e.g., `chat`, `execute_tool`, `invoke_agent`) classifies the operation, while trace/span parentage (`trace_id`, `parent_span_id`, `span_id`) defines con...",
    "what_was_observed": "A planner-executor agent ran a `chat` span (reasoning) that produced a tool call. The executor emitted `gen_ai.operation.name=execute_tool` with `gen_ai.tool.name`, a `gen_ai.usage.input_tokens`/`output_tokens` pair, and a `gen_ai.response.id`. Mid-tool-call the process was checkpointed (context window pressure triggered a serialize-resume). On resume: 1. The resumed agent rebuilt its span context from the checkpoint...",
    "condition_of_validity": "The invariant that must hold: **for any logical tool call identified by `(trace_id, gen_ai.tool.name, argument_fingerprint)`, at most one *completed* `execute_tool` span may carry billable `gen_ai.usage.*` attributes, and every such span must have a `parent_span_id` that resolves to a span in the same trace that was open at the time of the call.** This holds...",
    "decision_boundary": "The boundary is between **re-emit** and **adopt**: - *Re-emit* (the default, and the failure): generate a new span, let the original dangle. Valid only if the original span was explicitly `end()`-ed with an `error`/`abandoned` status before checkpoint, so cost aggregators can exclude it by status. - *Adopt*: on resume, query the checkpoint for an in-flight `...",
    "operational_effect": "Without the guardrail: cost telemetry double-counts every resumed tool call; trace graphs show orphaned `execute_tool` spans parented to a resume root, breaking causal reconstruction of the reasoning loop; and `gen_ai.usage.*` token totals become non-reconcilable against provider invoices because the abandoned attempt's tokens were still billed by the model ..."
  },
  "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": "0edf00c271673535079c4c40e3c85d99f3d76b5a2803635272fae839a459e2d8",
    "verified_classes": [
      "SpanContinuityViolation"
    ],
    "verified_functions": [
      "resolve_tool_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpanContinuityViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
