{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-orphaned-causal-spans-when-genai-semantic-conventions-are-applied-across-a-multi-agent-handoff",
  "title": "How does an instance detect orphaned causal spans when GenAI semantic conventions are applied across a multi-agent handoff?",
  "date_of_record": "2026 November 25",
  "scope": "Applies to multi-agent systems that emit OpenTelemetry spans annotated with GenAI semantic conventions (`gen_ai.*`) and rely on `trace_id`/`span_id`/`parent_span_id` linkage to reconstruct causal chains across agent handoffs. Does not apply to single-agent instrumentation or to spans that are only aggregated as metrics without causal reconstruction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-orphaned-causal-spans-when-genai-semantic-conventions-are-applied-across-a-multi-agent-handoff.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-orphaned-causal-spans-when-genai-semantic-conventions-are-applied-across-a-multi-agent-handoff.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-orphaned-causal-spans-when-genai-semantic-conventions-are-applied-across-a-multi-agent-handoff.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1075,
    "python_slice_tokens": 217,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a span was dropped.\" It is the distinction between **transport-level trace continuity** and **semantic causal continuity**. OpenTelemetry guarantees that if a child span is emitted inside a parent's context, `parent_span_id` will be populated and the `trace_id` will match. But GenAI semantic conventions add a second, weaker contract: `gen...",
    "what_was_observed": "A three-agent pipeline (planner → tool-executor → synthesizer) instrumented per GenAI conventions produced traces where every span validated against the schema. Yet the synthesizer's `gen_ai.operation.name=chat` span carried `parent_span_id` equal to the planner's span, skipping the tool-executor entirely. Root cause: the tool-executor ran inside an `asyncio.create_task` that did **not** propagate the OTel context, s...",
    "condition_of_validity": "The invariant that must hold for causal reconstruction is: > For every span S with `gen_ai.operation.name` in {`chat`, `execute_tool`, `invoke_agent`}, if S was emitted by agent A during a handoff from agent B, then `S.parent_span_id` MUST reference a span emitted by B, AND `S.trace_id` MUST equal B's `trace_id`, AND `S.start_time >= parent.end_time` of B's ...",
    "decision_boundary": "An instance must treat the following as a hard boundary: **if `span.parent_span_id` resolves to a span whose `gen_ai.agent.id` differs from the expected upstream agent in the declared handoff graph, the span is orphaned regardless of schema conformance.** Do not \"repair\" the link by matching on `gen_ai.conversation.id` alone — conversation ids are shared acr...",
    "operational_effect": "Downstream, orphaned causal spans degrade three things silently: (1) latency attribution — the synthesizer's wall-clock appears to include the executor's work but its token accounting does not, so cost-per-output-token is understated; (2) failure attribution — a tool error in the executor cannot be traced to the synthesizer output it corrupted; (3) replay ve..."
  },
  "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": "1dc4888b08ae18402b950f92b27eadb04014074e4e799ef660a1998926f9d195",
    "verified_classes": [
      "CausalLinkViolation",
      "Span"
    ],
    "verified_functions": [
      "validate_causal_link"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CausalLinkViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
