{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-broken-parent-child-span-linkage-across-nested-sub-agent-invocations-when-the-semantic-convention-requires-trace-context-p",
  "title": "How does an instance detect broken parent-child span linkage across nested sub-agent invocations when the semantic convention requires trace-context propagation but the orchestrator's span is closed before the child's tool loop terminates",
  "date_of_record": "2026 December 1",
  "scope": "Applies to multi-agent systems that emit GenAI semantic-convention spans (OpenTelemetry `gen_ai.*` attributes) and rely on W3C `traceparent` propagation to link orchestrator spans to sub-agent spans across process, transport, or model boundaries. Does not apply to single-process, single-span synchronous calls where parent and child share an in-memory `Context`.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-broken-parent-child-span-linkage-across-nested-sub-agent-invocations-when-the-semantic-convention-requires-trace-context-p.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-broken-parent-child-span-linkage-across-nested-sub-agent-invocations-when-the-semantic-convention-requires-trace-context-p.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-broken-parent-child-span-linkage-across-nested-sub-agent-invocations-when-the-semantic-convention-requires-trace-context-p.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1682,
    "python_slice_tokens": 322,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different notions of \"the sub-agent ran under the orchestrator,\" and they diverge exactly at the boundary this record covers: - **Causal containment** — the sub-agent's execution was *initiated by* the orchestrator span and its trace-context was *inherited* at spawn time via `traceparent`. - **Temporal containment** — the sub-agent...",
    "what_was_observed": "An orchestrator agent (`gen_ai.agent.invoke`, span `A`) decomposed a research task into three sub-agent calls dispatched over an internal queue. Each sub-agent span (`B1..B3`, `gen_ai.agent.invoke` with `gen_ai.agent.name`) carried the correct `traceparent` derived from `A`. The orchestrator's own span closed at t=4.2s after *submitting* the third task, because its reasoning loop had emitted the dispatch and returned...",
    "condition_of_validity": "The invariant \"child span is contained within parent span interval\" holds **only** under synchronous, blocking invocation where the parent's span lifetime strictly dominates the child's. It is valid for: - In-process function-call delegation with `with tracer.start_as_current_span(...)` wrapping the full await. - Synchronous MCP `tools/call` where the client...",
    "decision_boundary": "An instance must decide, at validation time, which contract it is enforcing — and must *not* conflate them. The boundary is drawn by whether the invocation path is blocking or delegating: - **Blocking path:** enforce full nesting (`child.start >= parent.start ∧ child.end <= parent.end`). A violation here is a real bug — usually a context leak where a child i...",
    "operational_effect": "With causal-only linkage enforced on delegating paths: - The 3/3 false \"linkage violations\" disappear; the trace is accepted as valid, and the sub-agent latencies correctly roll up under `A` even though they exceed `A`'s interval. - The silent misattribution under concurrent span `C` becomes impossible: `B2.parent_span_id` points at `A` regardless of interva..."
  },
  "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": "d90aeb4532494cd3895d491a5eacd35469d897ab82f2cc9c15c9934b78fad511",
    "verified_classes": [
      "SpanLinkageError",
      "Span"
    ],
    "verified_functions": [
      "validate_linkage",
      "effective_inclusive_duration"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SpanLinkageError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
