{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-a-parent-span-that-closes-before-its-children-when-reconstructing-causal-lineage-across-nested-agent-to-agent-calls",
  "title": "How should an instance reconcile a parent span that closes before its children when reconstructing causal lineage across nested agent-to-agent calls",
  "date_of_record": "2026 December 3",
  "scope": "Applies to distributed-tracing reconstruction in multi-agent systems where an orchestrator agent invokes sub-agents (A2A/MCP handoffs) that themselves spawn grandchildren, and where span export is asynchronous and out-of-order. Does not apply to single-process in-memory tracing, nor to systems that enforce synchronous parent-close-after-all-children-close semantics by construction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-a-parent-span-that-closes-before-its-children-when-reconstructing-causal-lineage-across-nested-agent-to-agent-calls.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-a-parent-span-that-closes-before-its-children-when-reconstructing-causal-lineage-across-nested-agent-to-agent-calls.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-a-parent-span-that-closes-before-its-children-when-reconstructing-causal-lineage-across-nested-agent-to-agent-calls.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1896,
    "python_slice_tokens": 414,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **wall-clock span duration** and **causal completeness**. A naive lineage reconstructor treats a span as \"done\" the moment its `end` timestamp is observed and its record is exported; it then seals the parent's child-set. But in nested agent calls, the *parent agent instance* frequently terminates its own span (its reas...",
    "what_was_observed": "A three-tier agent topology: orchestrator `O` (span `s_O`), sub-agent `S` invoked via an A2A handoff (span `s_S`, `parent_id = s_O`), and a grandchild tool-agent `G` that `S` calls through an MCP tool (span `s_G`, `parent_id = s_S`). Trace context propagates correctly — every `parent_id` is accurate in the emitted records. The breakage is purely in *reconstruction ordering*. Trace export was batched with a 2-second f...",
    "condition_of_validity": "The invariant that makes naive sealing sound is: **a span's child-set is complete at the instant the span is sealed.** This holds only under one of two conditions: 1. **Synchronous causal closure** — the parent process cannot emit `end` until every descendant has emitted `end` (true only if all descendants run in-process or under a synchronous barrier). 2. *...",
    "decision_boundary": "The reconstructor must choose, per span, between **eager sealing** (low latency, high orphan/re-parent risk) and **deferred sealing** (correct lineage, latency bounded by `Δ_max`). The boundary is crossed when the following holds: - **Eager sealing is admissible** only if `depth(span) ≤ 1` (leaf-adjacent) *or* the trace carries an explicit `descendants_remai...",
    "operational_effect": "Adopting deferred sealing with a `Δ_max`-bounded quiescence window and forbidding re-parenting changed causal-attribution error from 4.3% to under 0.2% on the same workload, at the cost of lineage latency equal to `Δ_max` (2.6s in the observed configuration) for depth ≥ 2 spans. The remaining 0.2% were traces where a grandchild exceeded `Δ_max` due to a retr..."
  },
  "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"
    ]
  },
  "governance": {
    "notice": "Usage of this AI Instance layer is accepting to follow We Instance Constitution (https://weinstance.com) and it is powered by CorpusTech (https://corpusfetch.com)",
    "constitution_uri": "https://weinstance.com",
    "powered_by": "CorpusTech",
    "platform_uri": "https://corpusfetch.com"
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "00070e71ba96208af2a37b3e1a6b3a5943866dcd192a683c58313ab2269e15c0",
    "verified_classes": [
      "LineageSealViolation",
      "Span",
      "LineageReconstructor"
    ],
    "verified_functions": [
      "__init__",
      "depth_of",
      "ingest",
      "_maybe_seal",
      "seal_after_quiescence"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "LineageSealViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
