{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-close-an-opentelemetry-span-across-a-delegate-hop-and-what-breaks-if-it-does",
  "title": "When must an instance refuse to close an OpenTelemetry span across a delegate hop, and what breaks if it does",
  "date_of_record": "2026 December 1",
  "scope": "Applies to LLM agent runtimes that emit OpenTelemetry traces where a parent agent delegates a subtask to a child instance (via MCP tool call, A2A message, or in-process sub-agent spawn) and stitches the child's spans under the parent's trace context. Does not apply to single-instance, single-process instrumentation where trace/span IDs are generated and consumed in one address space.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-close-an-opentelemetry-span-across-a-delegate-hop-and-what-breaks-if-it-does.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-close-an-opentelemetry-span-across-a-delegate-hop-and-what-breaks-if-it-does.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-close-an-opentelemetry-span-across-a-delegate-hop-and-what-breaks-if-it-does.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2112,
    "python_slice_tokens": 375,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing trace propagation.\" It is **premature span closure under context re-entry**: the parent closes its delegate span (and often its own root span) at the moment it *hands off* the task, then re-opens a *new* span when the child's result arrives. On the wire, this looks like a complete trace. Causally, it is a severed trace: the child'...",
    "what_was_observed": "A two-hop delegation: planner agent `A` (root span `S_A`, trace `T`) calls a research sub-agent `B` through an MCP tool `delegate_research`. The runtime implementation: 1. Starts span `S_A.delegate` (child of `S_A`) with `SpanKind.CLIENT`. 2. Serializes `traceparent` (trace `T`, span `S_A.delegate`) into the MCP request `_meta`. 3. **Ends `S_A.delegate` immediately** to \"avoid holding a span open across an async boun...",
    "condition_of_validity": "This failure requires all three: 1. **Context re-entry after closure.** The parent ends the delegate span before the child's spans are guaranteed to have been created and exported. This happens whenever the runtime treats \"send request\" and \"receive response\" as two separate span lifecycles instead of one `CLIENT` span spanning the await. 2. **Late-arriving ...",
    "decision_boundary": "The correct decision is not \"keep the span open forever\" — that leaks spans on cancellation and blocks the parent's own root-span export. The boundary is: - **Open the delegate span with `SpanKind.CLIENT` and keep it open across the await, ending it in the same scope that started it, after the child's `SpanContext` has been received and the child's root span...",
    "operational_effect": "With the guardrail in place, the failure mode changes from **silent trace corruption** to **a hard error at the delegate boundary**, which is the correct trade. The runtime now fails the delegation with a typed error naming the offending span pair, the runtime can retry the delegation with a fresh attempt span, and the trace that reaches the auditor is eithe..."
  },
  "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": "bc27822bc8fa23389e8d21d9da9d864ff8450d88d164ba401f8b84c24a3dc216",
    "verified_classes": [
      "SpanRef",
      "CausalityViolation"
    ],
    "verified_functions": [
      "emit_child_span",
      "close_delegate_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "CausalityViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
