{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-trace-span-joins-when-an-mcp-tool-call-is-retried-inside-an-a2a-task-graph-and-produces-duplicate-parent-spans",
  "title": "How should an instance reconcile trace-span joins when an MCP tool call is retried inside an A2A task graph and produces duplicate parent spans",
  "date_of_record": "2026 November 23",
  "scope": "Applies to observability pipelines that reconstruct causal agent traces by joining MCP transport-level spans (JSON-RPC request/response pairs over stdio or SSE) to A2A task-graph nodes via propagated trace context. Does not apply to single-hop, non-retried tool invocations or to pipelines that use wall-clock ordering instead of causal parent-child links.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-trace-span-joins-when-an-mcp-tool-call-is-retried-inside-an-a2a-task-graph-and-produces-duplicate-parent-spans.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-trace-span-joins-when-an-mcp-tool-call-is-retried-inside-an-a2a-task-graph-and-produces-duplicate-parent-spans.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-trace-span-joins-when-an-mcp-tool-call-is-retried-inside-an-a2a-task-graph-and-produces-duplicate-parent-spans.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1567,
    "python_slice_tokens": 334,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing spans\" or \"dropped telemetry.\" It is **span-identity divergence under idempotent retry**: an MCP client retries a tool call (because the transport timed out, the SSE stream dropped, or the LLM re-emitted the same `tool_use` block after a context replay), and the retry reuses the *logical* call identity (same A2A task node, same to...",
    "what_was_observed": "A three-hop agent executed an A2A task `t-7f3a` (delegated by an orchestrator to a worker agent). The worker called an MCP server tool `write_record` over SSE. Sequence: 1. Worker emits MCP request with `traceparent: 00-4bf9...-a1c2...-01`, span `a1c2` (child of A2A node span `d0e1`). 2. Server processes the write, but the SSE response frame is lost when the stream reconnects at t+820ms (server-side write committed)....",
    "condition_of_validity": "The dedup-by-key behavior is only sound under a condition that is almost never checked: **the tool must be idempotent, OR the pipeline must have an authoritative side-effect ledger independent of the trace.** Neither held here. The pipeline assumed \"last span wins\" was a safe summary because it conflated *transport retry* (where the first attempt genuinely d...",
    "decision_boundary": "The pipeline must branch on the **status class of the superseded span**: - If the superseded span's status is `refused` / `connection_reset_before_send` / `schema_validation_failed` (no bytes reached the server), collapse is safe: one logical call, one side effect. Emit one span, annotate `retries: 1`. - If the superseded span's status is `timeout` / `stream...",
    "operational_effect": "Without the boundary, three downstream systems fail silently: (1) cost accounting undercounts by the retry multiplier, (2) latency SLOs report the *winning* attempt only, hiding tail latency caused by retry storms, and (3) safety monitors keyed on error spans never fire because the error span was deduped. The fix is to make supersession explicit at emission ..."
  },
  "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": "db9c926bb00fb478881a3e477f8d65a6e2f2e8de179825698a54e2bc5bf6af9e",
    "verified_classes": [
      "SpanStatus",
      "TraceJoinError",
      "MCPSpan",
      "TaskNode"
    ],
    "verified_functions": [
      "join_spans"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TraceJoinError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
