{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-reports-tool-call-spans-without-a-parent-invoke-agent-span-orphaned-genai-telemetry-and-the-span-link-invariant",
  "title": "What happens when an instance reports tool-call spans without a parent `invoke_agent` span: orphaned GenAI telemetry and the span-link invariant",
  "date_of_record": "2026 November 16",
  "scope": "Applies to OpenTelemetry instrumentation of LLM agents that emit `gen_ai.*` semantic convention attributes across `invoke_agent`, `execute_tool`, and `chat`/`generate_content` spans, where the collector or backend performs parent-child reconstruction based on `trace_id`/`span_id` only. Does not apply to systems that exclusively use OTLP logs with embedded trace context, nor to single-shot model invocations that never involve tool calls.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reports-tool-call-spans-without-a-parent-invoke-agent-span-orphaned-genai-telemetry-and-the-span-link-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reports-tool-call-spans-without-a-parent-invoke-agent-span-orphaned-genai-telemetry-and-the-span-link-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reports-tool-call-spans-without-a-parent-invoke-agent-span-orphaned-genai-telemetry-and-the-span-link-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1489,
    "python_slice_tokens": 372,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters here is between *span presence* and *span topology*. The GenAI semantic conventions define attribute namespaces (`gen_ai.operation.name`, `gen_ai.agent.name`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.request.model`, `gen_ai.usage.input_tokens`, etc.) and specify that tool execution should be represented as `execute_tool...",
    "what_was_observed": "In a deployment instrumenting a planner/executor agent, `execute_tool` spans were emitted from a `ThreadPoolExecutor` whose worker threads did not inherit the OTel `Context`. The spans were created with valid `trace_id` (propagated via an explicit `Context.attach` in the submitting thread) but their parent was the executor's internal `run` span, not the `invoke_agent` span. Downstream, a trace-stitching pipeline that...",
    "condition_of_validity": "The invariant \"tool-call telemetry is attributable to the invoking agent span\" holds only when all three of the following are true: 1. The instrumentation guarantees `Context` propagation across the execution boundary that runs the tool (thread, process, async task, or remote hop), such that the `execute_tool` span's parent is the `invoke_agent` span or a de...",
    "decision_boundary": "The operational decision is whether to *reject* orphaned `execute_tool` spans at ingest or to *repair* them. Rejecting is correct when the backend's agent analytics depend on topology and a mis-parented span would corrupt latency percentiles; the cost is losing real tool executions that happened but were mis-instrumented. Repairing (re-parenting by `gen_ai.t...",
    "operational_effect": "Once the invariant is enforced (either by fixing context propagation or by join-key repair with quarantine on missing keys), agent latency rollups become correct, tool-call success rates stop being computed over a biased subset, and retry double-counting disappears. The residual effect is that the collector must carry a validation stage that knows the GenAI ..."
  },
  "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": "7a0c427095b4220d53380164c78669e095994617b4e150baa3590ff473f77e5d",
    "verified_classes": [
      "OrphanedToolSpanError",
      "Span"
    ],
    "verified_functions": [
      "validate_tool_attribution"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "OrphanedToolSpanError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
