{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-emits-orphaned-child-spans-after-a-mid-trace-parent-eviction-genai-span-correlation-failure-in-multi-hop-agent-trace-rec",
  "title": "What happens when an instance emits orphaned child spans after a mid-trace parent eviction: GenAI span correlation failure in multi-hop agent trace reconstruction",
  "date_of_record": "2026 November 24",
  "scope": "Applies to distributed tracing of multi-hop LLM agent pipelines (e.g., OpenTelemetry GenAI semantic conventions, LangSmith/Langfuse-style span trees) where parent spans are subject to eviction, TTL expiry, or sampling drop while child spans continue to be exported. Does not cover single-hop inference telemetry or traces where the collector guarantees atomic parent-child emission.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-orphaned-child-spans-after-a-mid-trace-parent-eviction-genai-span-correlation-failure-in-multi-hop-agent-trace-rec.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-orphaned-child-spans-after-a-mid-trace-parent-eviction-genai-span-correlation-failure-in-multi-hop-agent-trace-rec.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-orphaned-child-spans-after-a-mid-trace-parent-eviction-genai-span-correlation-failure-in-multi-hop-agent-trace-rec.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1501,
    "python_slice_tokens": 340,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing spans\" — collectors tolerate gaps. The failure is **correlation inversion**: a child span that *does* arrive carries a `parent_span_id` pointing at a span that will never arrive, and a naive reconstructor silently reparents it under the trace root or under the nearest surviving ancestor. This produces a trace tree that is *structu...",
    "what_was_observed": "A three-hop agent chain — `planner` → `retriever` → `synthesizer` — executed under a collector with a 30-second parent-span TTL applied to *high-cardinality* spans (the planner's reasoning span was tagged high-cardinality due to embedded prompt attributes and was evicted early). The retriever and synthesizer spans were emitted 41 seconds later, after the tool round-trips. Observed trace at reconstruction: - `trace_id...",
    "condition_of_validity": "The invariant that must hold for correct reconstruction is: > For every exported span S with a non-null `parent_span_id` P, either P is present in the reconstructed trace, or S is explicitly marked `ancestry_unresolved` and excluded from causal-path queries. Reparenting is only *safe* when the true parent is known to be a no-op pass-through (e.g., an instrum...",
    "decision_boundary": "The decision boundary is whether the reconstructor **distinguishes \"no parent\" from \"parent not yet arrived\" from \"parent will never arrive.\"** These are three states and a boolean `parent_span_id` field collapses them into one. Operational rule: a span whose parent is absent at reconstruction time must be held in a **pending-orphan buffer** for a bounded gr...",
    "operational_effect": "With `reparent_orphans=true`, the failure mode is silent and compounding across hops. In a five-hop chain where two intermediate reasoning spans are evicted, the reconstructed tree collapses four causal edges into two, and any metric computed over the tree — per-hop latency, per-hop token cost, fan-out — is systematically biased toward under-attribution of t..."
  },
  "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": "a2a80f139dacbdcb7743622571b913c62d5f6c0a4c288e13051cca90f85d2d09",
    "verified_classes": [
      "AncestryResolutionError",
      "Span",
      "Reconstructor"
    ],
    "verified_functions": [
      "causal_path",
      "ingest",
      "finalize"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "AncestryResolutionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
