{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-reject-opentelemetry-genai-spans-whose-parent-context-was-exported-before-a-tool-call-re-entry-and-how-does-span-co",
  "title": "In what scenarios must an instance reject OpenTelemetry GenAI spans whose parent context was exported before a tool-call re-entry, and how does span-context staleness corrupt agent-turn causality?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to any agent runtime that emits OpenTelemetry spans under the GenAI semantic conventions (`gen_ai.operation.name`, `gen_ai.tool.call.id`, `gen_ai.agent.turn`) and resumes a suspended turn by re-attaching to a `SpanContext` captured before a tool call. Does not apply to stateless single-shot inference where each span is rooted at request entry.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-spans-whose-parent-context-was-exported-before-a-tool-call-re-entry-and-how-does-span-co.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-spans-whose-parent-context-was-exported-before-a-tool-call-re-entry-and-how-does-span-co.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-spans-whose-parent-context-was-exported-before-a-tool-call-re-entry-and-how-does-span-co.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1860,
    "python_slice_tokens": 284,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions model an agent turn as a span tree: a parent `invoke_agent` span, child `chat` spans per model call, and child `execute_tool` spans per tool invocation. The convention assumes the parent span remains *live* for the duration of the turn — that its `SpanContext` (trace-id + span-id + trace-flags) is a valid, non-expired handle th...",
    "what_was_observed": "A multi-step agent (plan → tool call → resume → synthesize) suspended at the tool boundary for a median of 4.2s (p99 41s) while the external tool executed. The runtime serialized `{trace_id, span_id, trace_flags}` into the checkpoint blob alongside the conversation state, and on resume called `trace.set_span_in_context(captured_context)` before emitting the post-tool `chat` span. The captured context was the `invoke_...",
    "condition_of_validity": "A `SpanContext` is a valid re-attachment parent **iff** the span it identifies has not yet been ended at the moment of re-attachment. This is the invariant the GenAI conventions leave implicit: `SpanContext` is an *identifier*, not a *liveness token*. Nothing in the OTLP wire format or the SDK rejects a child whose parent has already been exported — the SDK'...",
    "decision_boundary": "On resume, the runtime must decide between re-attach and re-root. The decision is not \"do we have a captured context?\" — we almost always do. It is: The third branch is the one operators omit. A persisted `SpanContext` carries no `ended` flag — the SDK does not serialize span lifecycle into the context. So a runtime that only has the context *cannot distingu...",
    "operational_effect": "Without the guard, every suspended turn produces a trace where the parent's measured duration understates true turn latency by exactly the suspension interval — and the suspension interval is the tool latency, which is frequently the largest single cost. Cost attribution, latency SLOs, and critical-path analysis all read the parent span, so all three silentl..."
  },
  "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": "d03db4ebc51a64803858a238b0448fd1ca22e71a6245baced46c9cd138fa8010",
    "verified_classes": [
      "StaleSpanContextError",
      "SpanContext"
    ],
    "verified_functions": [
      "resolve_resume_parent",
      "emit_resumed_chat_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "StaleSpanContextError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
