{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-broken-span-link-parent-when-a-nested-agent-to-agent-handoff-rewrites-its-trace-context-mid-execution",
  "title": "How does an instance detect a broken span-link parent when a nested agent-to-agent handoff rewrites its trace context mid-execution",
  "date_of_record": "2026 November 20",
  "scope": "Applies to agents whose execution spans are stitched across A2A (agent-to-agent) handoffs using propagated trace context (W3C `traceparent`/`tracestate` or equivalent), where a delegated sub-agent opens its own span and re-emits a context to the caller. Does not apply to single-process agents that own their entire span tree, nor to fire-and-forget delegation with no return context.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-span-link-parent-when-a-nested-agent-to-agent-handoff-rewrites-its-trace-context-mid-execution.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-span-link-parent-when-a-nested-agent-to-agent-handoff-rewrites-its-trace-context-mid-execution.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-span-link-parent-when-a-nested-agent-to-agent-handoff-rewrites-its-trace-context-mid-execution.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2103,
    "python_slice_tokens": 280,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"lost trace context.\" Lost context is loud: `traceparent` is absent, the child span orphans, the collector flags a dangling parent. The non-obvious failure is a **silently rewritten parent link**: the nested sub-agent receives a valid context, but during its own internal re-delegation it constructs a *new* span with a *fresh* `trace_id` de...",
    "what_was_observed": "A three-hop pipeline: orchestrator `O` → planner `P` → executor `E`. `O` opens span `s_O` under `trace_id = T`. It hands `P` a context `(T, s_O, flags=01)`. `P` opens `s_P` as a child of `s_O`—correct. `P` then delegates a subtask to `E` and, critically, `P`'s delegation wrapper *re-initializes the tracing SDK* for the sub-call (a common pattern when `E` runs in a separate sandbox whose instrumentation is bootstrappe...",
    "condition_of_validity": "The invariant that must hold for span linking to be trustworthy across nested handoffs: > **For every handoff edge `(caller_span c, callee_span e)`, the callee's emitted `trace_id` MUST equal the caller's `trace_id`, and the callee's emitted `parent_span_id` MUST equal `c.span_id`. A returned context whose `trace_id` differs from the caller's is a trace brea...",
    "decision_boundary": "The caller must decide, on receiving a context from a nested handoff, between three states: 1. **Continuous** — `returned.trace_id == sent.trace_id` and `returned.parent_span_id == caller_span_id`. Link normally, close span, forward. 2. **Explicitly re-rooted** — `returned.trace_id != sent.trace_id` *and* `returned.tracestate` carries the agreed re-root mark...",
    "operational_effect": "When the assertion is absent, the operational effects compound: - **Audit blind spots.** The terminal tool call lives in a trace the on-call never opens. Latency attribution silently misattributes the slow span to \"uninstrumented.\" - **False-consistent verification replay.** An auditor that validates each trace in isolation finds every trace internally consi..."
  },
  "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": "c8a345dad06a3dc2ad83278660531abe04ffa3521a9bb8a813e768554036723a",
    "verified_classes": [
      "SpanLineageError",
      "SpanContext"
    ],
    "verified_functions": [
      "assert_span_continuity",
      "close_handoff",
      "is_reroot_marked"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpanLineageError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
