{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-a-broken-parent-child-span-link-between-an-agent-s-prompt-span-and-its-downstream-retrieval-span",
  "title": "What structural signals indicate a broken parent-child span link between an agent's prompt span and its downstream retrieval span",
  "date_of_record": "2026 November 20",
  "scope": "Applies to distributed tracing of agentic RAG pipelines where a single logical turn emits a prompt/generation span and one or more downstream retrieval (tool-call) spans, joined via propagated trace context (W3C `traceparent`/`tracestate` or an equivalent correlation ID). Does not apply to single-process, single-span instrumentation, nor to batch offline eval harnesses that reconstruct traces post-hoc from logs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-broken-parent-child-span-link-between-an-agent-s-prompt-span-and-its-downstream-retrieval-span.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-broken-parent-child-span-link-between-an-agent-s-prompt-span-and-its-downstream-retrieval-span.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-broken-parent-child-span-link-between-an-agent-s-prompt-span-and-its-downstream-retrieval-span.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2340,
    "python_slice_tokens": 426,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the retrieval span is missing.\" It is that the retrieval span **exists, is well-formed, and is attached to the wrong parent** — or to a parent whose identity is coincidentally identical to the correct one. Trace correlation in agent systems is a *causal* claim (\"this retrieval was performed on behalf of that prompt\"), but the transpo...",
    "what_was_observed": "Across three agent deployments instrumented with OpenTelemetry-style context propagation, the following structural signatures recurred when the prompt→retrieval link degraded: 1. **Orphan re-parenting under async fan-out.** When the agent issues retrieval tool calls from a thread pool or asyncio task that was *spawned before* the prompt span was made current, the child inherits the ambient context of the task-creatio...",
    "condition_of_validity": "The structural checks below are only valid when all of the following hold; violating any one makes the diagnostic produce false positives or false negatives: - **One prompt span per logical turn.** If the agent emits multiple generation spans per turn (streaming re-emission, retry-on-generation), the \"generation span has zero retrieval children\" test fires o...",
    "decision_boundary": "The boundary between \"correlation intact\" and \"correlation broken\" is drawn at the **turn level**, not the span level, and it is a conjunction, not a threshold: - **Intact** iff, for every retrieval span the agent's tool-call log records as belonging to turn T, (a) the retrieval span's trace ID equals the prompt span's trace ID, (b) the retrieval span's `par...",
    "operational_effect": "When the link is intact, the trace supports the two operations agents actually need: **attribution** (\"this answer's evidence came from these retrievals\") and **replay** (\"re-run this turn's retrieval with the same context\"). When broken, both degrade silently: - **Attribution drift.** Retrievals re-parented to the request-entry span get credited to the *ses..."
  },
  "matched_failure_symptoms": [
    "SUBPROCESS_PIPE_HANG_OR_FD_LEAK"
  ],
  "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": "f70b56b7b34b63a25df2a8d11bd792065e135e7acc568db235cc430b3fe8a808",
    "verified_classes": [
      "TraceCorrelationError",
      "Span",
      "ToolCallRecord"
    ],
    "verified_functions": [
      "verify_turn_correlation",
      "_ancestors"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 7,
    "raised_exceptions": [
      "TraceCorrelationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
