{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-reuses-a-parent-span-id-across-a-delegated-subtask-boundary-orphaned-genai-semantic-convention-spans-and-the-trace-corre",
  "title": "What happens when an instance reuses a parent span ID across a delegated subtask boundary: orphaned GenAI semantic-convention spans and the trace-correlation break in multi-agent handoffs",
  "date_of_record": "2026 November 26",
  "scope": "Applies to multi-agent systems that emit OpenTelemetry traces using the GenAI semantic conventions (`gen_ai.*` attributes) and correlate child-agent spans to parent spans via `parent_span_id` / `trace_id` propagation across an explicit handoff (A2A, MCP tool-call, or message-queue delegation). Does not apply to single-agent instrumentation where all spans are emitted in-process by one runtime, nor to systems using a flat, correlation-ID-only logging scheme without span trees.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reuses-a-parent-span-id-across-a-delegated-subtask-boundary-orphaned-genai-semantic-convention-spans-and-the-trace-corre.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reuses-a-parent-span-id-across-a-delegated-subtask-boundary-orphaned-genai-semantic-convention-spans-and-the-trace-corre.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reuses-a-parent-span-id-across-a-delegated-subtask-boundary-orphaned-genai-semantic-convention-spans-and-the-trace-corre.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1899,
    "python_slice_tokens": 272,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways a child agent can be linked into a parent's trace, and they fail differently: 1. **Context propagation** — the parent passes its live `SpanContext` (trace_id + span_id + trace_flags) to the child, and the child's runtime constructs child spans with that context as parent. The span tree is built by the SDK at emit time; the child never inve...",
    "what_was_observed": "A three-tier delegation: planner agent → two worker agents (fan-out) → one verifier agent (fan-in). Planner emits `gen_ai.chat` span `S_p` (span_id `a1`). It serializes `{trace_id: T, parent_span_id: a1}` into each worker's task envelope and ends `S_p` immediately after dispatch (correct — the planner's turn is over). Worker 1 reconstructs context from the envelope, emits `gen_ai.tool_call` span `S_w1` with `parent_s...",
    "condition_of_validity": "The orphan/mis-link only manifests when **all** of the following hold: - The child reconstructs parent context from a serialized payload rather than receiving a live `SpanContext` (i.e., process/instance boundary crossed). - The parent span has ended before the child emits (true for any async handoff — the planner does not block on workers). - Span IDs on th...",
    "decision_boundary": "The architectural choice is **where uniqueness is enforced**: - **Enforce at emit (correct):** every span emission draws a fresh random `span_id` from a CSPRNG; the reconstructed `parent_span_id` is *only ever read*, never written back as a child's own ID. Retries therefore produce distinct `span_id`s and the tree records both attempts as siblings — which is...",
    "operational_effect": "Downstream of a broken link: - **Cost attribution drifts.** `gen_ai.usage.*` rollups attribute retried work to the wrong parent, so per-agent cost dashboards under-report workers and over-report planners. - **Verification provenance is lost.** An auditor replaying the trace cannot tell which worker attempt the verifier approved. In an eval or compliance cont..."
  },
  "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": "16c4d528be4e73ddaacd2ecd472dcf88301958376ded8ec461e836d387ab7f32",
    "verified_classes": [
      "SpanLinkIntegrityError",
      "Span",
      "Collector"
    ],
    "verified_functions": [
      "reconstruct_child_span",
      "emit_retried_worker",
      "ingest"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpanLinkIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "secrets"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
