{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-causal-span-orphaning-in-opentelemetry-genai-traces-when-multi-agent-handoffs-cross-context-window-compaction-boundaries",
  "title": "Which invariants prevent causal span-orphaning in OpenTelemetry GenAI traces when multi-agent handoffs cross context-window compaction boundaries",
  "date_of_record": "2026 November 29",
  "scope": "Applies to multi-agent systems emitting OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) where a parent agent delegates to a child agent whose execution context is rebuilt from a compacted/summarized transcript rather than the live parent context. Does not apply to single-agent traces or to handoffs where the full parent `trace_id`/`span_id` pair is propagated verbatim through an in-process call stack.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-causal-span-orphaning-in-opentelemetry-genai-traces-when-multi-agent-handoffs-cross-context-window-compaction-boundaries.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-causal-span-orphaning-in-opentelemetry-genai-traces-when-multi-agent-handoffs-cross-context-window-compaction-boundaries.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-causal-span-orphaning-in-opentelemetry-genai-traces-when-multi-agent-handoffs-cross-context-window-compaction-boundaries.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1869,
    "python_slice_tokens": 298,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing spans\" and it is not \"broken trace propagation\" in the W3C sense. It is *causal span-orphaning under context compaction*: the child agent inherits a *semantically reconstructed* view of the parent conversation but not the *structural* parent span context, so it emits spans that are individually valid, correctly parented to the chi...",
    "what_was_observed": "A three-tier agent (Planner → Retriever → Synthesizer) running under a 32k context budget. The Planner's transcript crossed the compaction threshold at step 14; the runtime summarized turns 1–9 into a 900-token digest and continued. At step 15 the Planner delegated to the Retriever via a tool call (`delegate_retrieval`). The delegation payload carried the *summarized* conversation, and the child runtime — built from ...",
    "condition_of_validity": "The invariant \"a child agent's root span is parented to the delegating span\" holds **only if** the parent span context survives every transformation between the delegating call site and the child's `TracerProvider.start_span` call. This is not guaranteed by the OpenTelemetry spec; it is guaranteed only by an explicit propagation contract that covers *all* co...",
    "decision_boundary": "The boundary is: *does the child runtime know it was supposed to have a parent?* Two regimes: - **Regime 1 (parent expected, present):** Standard W3C propagation. Child starts span with `parent=remote_context`. Invariant holds. - **Regime 2 (parent expected, absent):** This is the dangerous regime. The child runtime *cannot distinguish* \"I am a legitimate ro...",
    "operational_effect": "Without the invariant, three downstream systems degrade: 1. **Cost attribution:** Per-tenant and per-agent cost rollups require the causal edge to walk from a leaf generation span up to the billing principal. Orphaned roots break the walk at the fork; the rollup either attributes to the wrong principal or falls back to \"unattributed,\" which is worse than wro..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "47fcb5799895684cfa9b8d8ff376d8305cf4e62f5646fa6d596fbb1d638a7f05",
    "verified_classes": [
      "CausalLinkSeveredError",
      "DelegationPayload"
    ],
    "verified_functions": [
      "compact_transcript",
      "child_bootstrap",
      "assert_delegation_has_child"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CausalLinkSeveredError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
