{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-of-an-agent-delegation-chain-loses-its-parent-span-link-orphaned-genai-semantic-convention-spans-at-the-second-level-del",
  "title": "What happens when an instance of an agent delegation chain loses its parent span link: orphaned GenAI semantic convention spans at the second-level delegation boundary",
  "date_of_record": "2026 November 18",
  "scope": "Applies to OpenTelemetry-instrumented multi-agent systems where GenAI semantic conventions (`gen_ai.*` attributes) are emitted across two or more levels of agent delegation, and where each delegation creates a new span whose parent is expected to be the delegating agent's span. Does not apply to flat single-agent tool-call traces, nor to systems that propagate a W3C `traceparent` header through every delegation hop as a hard requirement.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-of-an-agent-delegation-chain-loses-its-parent-span-link-orphaned-genai-semantic-convention-spans-at-the-second-level-del.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-of-an-agent-delegation-chain-loses-its-parent-span-link-orphaned-genai-semantic-convention-spans-at-the-second-level-del.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-of-an-agent-delegation-chain-loses-its-parent-span-link-orphaned-genai-semantic-convention-spans-at-the-second-level-del.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1566,
    "python_slice_tokens": 286,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There is a difference between *trace context propagation* (the W3C `traceparent`/`tracestate` mechanism that carries trace ID, span ID, and flags across process boundaries) and *semantic span linking* (the `gen_ai.*` attributes and explicit `SpanLink` objects that record *why* a span exists and *which* prior span caused it). A system can have perfect context...",
    "what_was_observed": "In a three-tier delegation (Orchestrator → Planner → Executor), with each tier instrumented independently: 1. Orchestrator creates span `A` (root), sets `gen_ai.request.model`, and calls Planner with a propagated `traceparent` pointing to `A`. 2. Planner's instrumentation starts span `B` using the inbound context as parent — correct, `B.parent = A`. 3. Planner performs an internal *re-planning loop* that calls `trace...",
    "condition_of_validity": "This failure is *structurally latent* but only *materializes* under a conjunction of conditions: - The intermediate agent crosses an async task boundary (`asyncio.create_task`, thread pool handoff, or Celery/queue hop) between receiving the inbound context and starting the outbound delegation span. - The instrumentation library does **not** re-inject `SpanLi...",
    "decision_boundary": "The operational decision is whether to treat an orphaned delegation span as an **error** or as a **degraded-but-acceptable** record. - **Treat as error** when span linkage is load-bearing for billing, SLO attribution, or safety auditing (e.g., attributing a harmful tool call to the originating user request). In these contexts an orphaned span is a *correctne...",
    "operational_effect": "Concretely, in the observed incident: - Cost rollup by `gen_ai.usage.input_tokens` grouped by root span undercounted Planner+Executor spend by ~31% because Executor spans were attributed to a separate root. - p99 latency for the orchestrator was reported as 2.1s; the true end-to-end including Executor was 7.4s. The gap was invisible because the Executor subt..."
  },
  "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": "7b769250d31b43e4011acf6094b5f1a592dae65bb0fb5ca4ddf61399f04d2bba",
    "verified_classes": [
      "OrphanedDelegationSpanError",
      "SpanRecord"
    ],
    "verified_functions": [
      "validate_delegation_linkage",
      "emit_delegation_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "OrphanedDelegationSpanError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
