{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-s-span-tree-silently-fork-when-opentelemetry-genai-semconv-attributes-are-emitted-from-a-resumed-agent-after-a-mid-task-checkpoin",
  "title": "Why does an instance's span tree silently fork when OpenTelemetry GenAI semconv attributes are emitted from a resumed agent after a mid-task checkpoint",
  "date_of_record": "2026 November 27",
  "scope": "Applies to LLM agent runtimes that emit OpenTelemetry spans per the GenAI semantic conventions (`gen_ai.*`) and persist execution state across process boundaries (checkpoint/resume, worker restart, cold-start replay). Does not cover single-process, never-interrupted agents, nor non-OTel tracing backends that ignore `trace_id`/`span_id` linkage.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-s-span-tree-silently-fork-when-opentelemetry-genai-semconv-attributes-are-emitted-from-a-resumed-agent-after-a-mid-task-checkpoin.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-s-span-tree-silently-fork-when-opentelemetry-genai-semconv-attributes-are-emitted-from-a-resumed-agent-after-a-mid-task-checkpoin.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-s-span-tree-silently-fork-when-opentelemetry-genai-semconv-attributes-are-emitted-from-a-resumed-agent-after-a-mid-task-checkpoin.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1611,
    "python_slice_tokens": 349,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There is a difference between *recording* an agent's execution and *reconstructing* its causal trace. The GenAI semconv (`gen_ai.operation.name`, `gen_ai.request.model`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.tool.name`, `gen_ai.system`) describes what happened in each span. It does **not** define how a resumed agent re-attaches i...",
    "what_was_observed": "A multi-step tool-using agent (planner → 4 tool calls → synthesis) was checkpointed after tool call #2 during a worker drain. The checkpoint contained: message history, tool-call ledger, token counters, and a `resume_seq` integer. It did **not** contain the OTel `SpanContext`. On resume: - The pre-checkpoint trace (`trace_id=A`) held `invoke_agent` root, plan span, and tool spans #1–#2, with `gen_ai.usage.input_token...",
    "condition_of_validity": "The fork is guaranteed to occur whenever all of the following hold: 1. The agent's durable checkpoint omits the serialized `SpanContext` (specifically `trace_id`, current `span_id`, `trace_flags`, and `tracestate`). 2. The resume path uses `tracer.start_span(...)` or `start_as_current_span(...)` without an explicit `context=` carrying the restored remote par...",
    "decision_boundary": "The invariant to enforce: **an agent's durable checkpoint must be a superset of its OTel active context at checkpoint time, or the resumed spans must be explicitly linked with a declared `resume_of` attribute and the token counters must be carried as a delta, not re-measured.** Choose between two bounded designs: - **Single-tree resume** (preferred when a ve...",
    "operational_effect": "Downstream consumers of the trace — cost attribution, trace-based hallucination verifiers, latency SLOs computed per root span — all degrade without any error signal. Cost dashboards over-report by the replay factor. Verifiers that require every synthesis span to have a producing tool-call ancestor reject valid runs. Latency SLOs computed per `invoke_agent` ..."
  },
  "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": "a641cd6339725974e7933a1c3e8b096615e8030dbe56016ede75a3803f18130d",
    "verified_classes": [
      "TraceContextForkError",
      "SpanContext",
      "Checkpoint",
      "EmittedSpan"
    ],
    "verified_functions": [
      "resume_agent_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TraceContextForkError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
