{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-span-parentage-when-an-mcp-tool-call-outlives-the-a2a-task-that-spawned-it",
  "title": "How should an instance reconcile span-parentage when an MCP tool call outlives the A2A task that spawned it",
  "date_of_record": "2026 November 29",
  "scope": "Applies to observability pipelines that stitch a single causal trace across a model invocation, the A2A task it emits, and the MCP tool calls executed inside that task, where any leg can have an independent lifetime. Does not apply to single-process, synchronous tool-calling loops where the tool call is a child of the model span by construction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-span-parentage-when-an-mcp-tool-call-outlives-the-a2a-task-that-spawned-it.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-span-parentage-when-an-mcp-tool-call-outlives-the-a2a-task-that-spawned-it.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-span-parentage-when-an-mcp-tool-call-outlives-the-a2a-task-that-spawned-it.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2056,
    "python_slice_tokens": 395,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a span got lost.\" It is a **parentage inversion**: the trace graph asserts a causal edge that the execution did not honor. Concretely, an A2A task span `T` is emitted with `status=completed` and a terminal timestamp when the orchestrating agent returns its answer to the caller. But an MCP tool call `M` dispatched *during* `T` — say a long...",
    "what_was_observed": "A three-tier pipeline: model invocation emits `gen_ai.*` span `G`; the agent framework emits an A2A task span `T` as a child of `G`; the MCP client emits tool spans `M1..Mn` as children of `T`. In a sampled reproduction, `T` was closed by the orchestrator's `finally` block on return of the final assistant message. `M3` (a remote MCP `fetch_document` with a 90 s server-side timeout) was dispatched 4 s before `T` close...",
    "condition_of_validity": "The invariant that must hold for a trace to be *causally faithful* is: > For every span `S` with parent `P`, `S.end_time <= P.end_time` **or** `P` is explicitly marked `open`/`draining` and is not eligible for idle eviction until all known children have closed. This is a *bounded* invariant, not an absolute one. It holds only when the pipeline can enumerate ...",
    "decision_boundary": "The architectural choice is whether to (a) **extend the parent's lifetime** to cover its children (parent stays `open` until child count reaches zero), or (b) **decouple lifetime from causality** by emitting a *link* rather than a parent edge for work that can outlive the task, and closing the parent on its logical completion. Choose (a) when the parent's du...",
    "operational_effect": "With deferred eviction (option a enforced at the collector), the p99 task-latency metric rose 67 s at the tail — which was *correct*, because that work was real and caused by the task. The verifier's false-completion bug disappeared because `T.status` did not flip to `completed` until `M3` closed. Cost: traces with genuinely abandoned children (a tool call t..."
  },
  "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": "c699dd4969ad1826617ae1adc6a5950b3e0ee5a057c864689c3f17a5fb347fb5",
    "verified_classes": [
      "TraceParentageError",
      "Span",
      "TraceCollector"
    ],
    "verified_functions": [
      "__init__",
      "open_child",
      "close_child",
      "close_parent",
      "evict_if_idle"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TraceParentageError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
