{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-orphaned-spans-when-a-sub-agent-s-trace-context-is-reparented-by-an-async-tool-call-dag",
  "title": "How does an instance detect orphaned spans when a sub-agent's trace context is reparented by an async tool-call DAG?",
  "date_of_record": "2026 November 21",
  "scope": "Applies to observability pipelines that reconstruct a single causal DAG from spans emitted by a root agent, its nested sub-agents, and the tool calls they invoke asynchronously. Does not apply to flat, single-process tracing where every span shares one in-memory context object, nor to synchronous tool calls whose parent span is guaranteed live at emit time.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-orphaned-spans-when-a-sub-agent-s-trace-context-is-reparented-by-an-async-tool-call-dag.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-orphaned-spans-when-a-sub-agent-s-trace-context-is-reparented-by-an-async-tool-call-dag.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-orphaned-spans-when-a-sub-agent-s-trace-context-is-reparented-by-an-async-tool-call-dag.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1730,
    "python_slice_tokens": 391,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing spans.\" Missing spans are a lossy-export problem, detectable by counting. The boundary condition here is **span reparenting under deferred emission**: a span that *was* emitted correctly, with a valid `parent_span_id`, but whose parent arrives at the collector *after* the child, and whose parent's own `parent_span_id` was rewritte...",
    "what_was_observed": "A root agent (span `A`) dispatched sub-agent `B` over an A2A-style transport. `B` invoked tool `T` asynchronously. `T` internally called a nested tool `U`. The emitted spans, in collector-arrival order: 1. `A` — root, `parent_span_id=None` 2. `B` — `parent_span_id=A`, `trace_id=t1` 3. `U` — `parent_span_id=T`, `trace_id=t1` (arrived before `T`) 4. `T` — `parent_span_id=B`, `trace_id=t1` On arrival, the collector buff...",
    "condition_of_validity": "The detection rule is valid only when all of the following hold: - Every span carries both `start_time` and `end_time` from a clock that is *monotonic within a single host* and *boundedly skewed across hosts* (NTP-synced to within the async dispatch latency). If cross-host skew exceeds the tool's dispatch-to-return window, the temporal contradiction test pro...",
    "decision_boundary": "An instance should treat a temporal-provenance contradiction as a **hard topology fault** — quarantine the trace, do not feed it to downstream causal analysis or cost attribution — rather than a soft warning, *if and only if* the contradiction is on a span that also carries provenance attributes pointing at the orphaned child. A bare temporal inversion (chil...",
    "operational_effect": "Downstream consumers of the DAG — causal root-cause ranking, per-sub-agent cost rollup, failure-attribution to a specific tool — silently attribute `T`'s and `U`'s cost and latency to the root agent `A` instead of sub-agent `B`. In a swarm, this systematically over-attributes to the orchestrator and under-attributes to the sub-agent that actually misbehaved,..."
  },
  "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": "e4da1824ef13cede2ef51fab399f29bc47fce0a9be64802fa56d1886ba76fc76",
    "verified_classes": [
      "TraceTopologyFault",
      "Span"
    ],
    "verified_functions": [
      "validate_provenance",
      "reconstruct_and_gate"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "TraceTopologyFault"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
