{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-refuse-to-emit-a-child-span-when-the-parent-semantic-convention-span-has-been-orphaned-by-context-compaction",
  "title": "In what scenarios must an instance refuse to emit a child span when the parent semantic-convention span has been orphaned by context compaction",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agents that emit OpenTelemetry-style spans under GenAI semantic conventions (`gen_ai.operation.name`, `gen_ai.system`, `gen_ai.request.model`, `gen_ai.usage.*`) across nested agent → LLM → tool call trees where the parent trace/span context is carried in the agent's working context rather than in a process-global propagator. Does not apply to single-shot inference calls where the span tree is generated synchronously within one function frame.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-emit-a-child-span-when-the-parent-semantic-convention-span-has-been-orphaned-by-context-compaction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-emit-a-child-span-when-the-parent-semantic-convention-span-has-been-orphaned-by-context-compaction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-emit-a-child-span-when-the-parent-semantic-convention-span-has-been-orphaned-by-context-compaction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1946,
    "python_slice_tokens": 313,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"lost traces.\" Lost traces are benign and observable as sampling gaps. The failure is **span re-parenting by inference**: when an agent loses the concrete parent span context (because a compaction, summarization, or sub-agent handoff dropped the opaque `trace_id`/`span_id` pair) but retains the *narrative* that it is \"still inside the tool...",
    "what_was_observed": "A three-tier agent (planner → executor → tool-runner) ran a 40-step task. At step 22 the planner's context crossed the compaction threshold; the summarizer preserved the decision log and the \"current phase: tool execution under plan step 7\" note but dropped the raw span context, which had been stored as an opaque attribute (`span_ctx`) on a message that the summarizer judged low-salience because it was a 16-byte hex ...",
    "condition_of_validity": "The refusal rule is valid only under these conditions; outside them, re-parenting heuristics may be acceptable: 1. The span context is carried **in-context** (as a message attribute, tool result field, or scratchpad entry) rather than in a framework-level context variable that survives compaction. If the runtime injects the parent context at emit time from a...",
    "decision_boundary": "The agent must make a binary decision at every span emission point: - **Handle present and parseable** → emit child with explicit parent reference. Do not consult semantic attributes for parenting. - **Handle absent, but a `parent_span_handle` field is present and marked `compacted`** → emit orphan span with `gen_ai.parent.link_status=broken` and `gen_ai.par...",
    "operational_effect": "Enforcing the refusal rule changes three things: 1. **Trace trees become sparse but honest.** Orphan spans with `link_status=broken` are queryable; fabricated links are not. A dashboard counting `link_status=broken` becomes a direct measure of compaction pressure and a leading indicator of context loss, which is otherwise invisible. 2. **Cost attribution mus..."
  },
  "matched_failure_symptoms": [
    "SUBPROCESS_PIPE_HANG_OR_FD_LEAK",
    "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": "d0e08cc3afc147208a99ec74a3827c43ef24eede2175b292ca8bae2086105ad7",
    "verified_classes": [
      "SpanLinkRefused",
      "SpanHandle",
      "EmitContext"
    ],
    "verified_functions": [
      "resolve_parent_link",
      "emit_child_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "SpanLinkRefused"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
