{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-broken-genai-trace-link-when-opentelemetry-span-propagation-silently-drops-the-parent-context-and-token-accounting-becom",
  "title": "How does an instance detect a broken GenAI trace link when OpenTelemetry span propagation silently drops the parent context and token accounting becomes double-counted?",
  "date_of_record": "2026 December 2",
  "scope": "Applies to multi-agent systems where each LLM invocation and tool call emits OpenTelemetry spans under the GenAI semantic conventions (`gen_ai.*`), and where agent-to-agent handoffs propagate trace context via `traceparent`/`tracestate`. Does not cover single-process, single-span instrumentation without cross-agent handoff, nor non-OTel tracing backends.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-genai-trace-link-when-opentelemetry-span-propagation-silently-drops-the-parent-context-and-token-accounting-becom.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-genai-trace-link-when-opentelemetry-span-propagation-silently-drops-the-parent-context-and-token-accounting-becom.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-broken-genai-trace-link-when-opentelemetry-span-propagation-silently-drops-the-parent-context-and-token-accounting-becom.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1985,
    "python_slice_tokens": 388,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A GenAI span is *structurally valid* (correct attributes, well-formed IDs) yet *semantically orphaned* when its parent context is dropped at an agent boundary. The distinction that matters: **trace correctness is not the same as span correctness.** A downstream agent can emit perfectly conformant `gen_ai.chat` and `gen_ai.tool` spans — correct `gen_ai.usage....",
    "what_was_observed": "An orchestrator agent (Agent A) invokes a sub-agent (Agent B) over an HTTP-based A2A transport. Agent A emits a `gen_ai.chat` span with `trace_id=T`, `span_id=S_A`, and serializes W3C context into the outbound request headers. Agent B's runtime uses an async worker pool; the inbound request is accepted by a gateway coroutine, then dispatched to a worker. The gateway extracts `traceparent` into a context variable, but...",
    "condition_of_validity": "The guardrail only holds under an explicit, checkable condition. For a GenAI trace to be trustworthy for token accounting and causal reconstruction, **all of the following must be true at span emission time**: - The span's `parent_span_id` is non-empty and resolves to an existing span in the same `trace_id`, *or* the span is the single declared root of the t...",
    "decision_boundary": "The boundary is whether the system **trusts the transport to preserve context** or **verifies context at the receiver before emitting**. - **Trust-the-transport (fails here):** the receiver assumes `traceparent` was attached and that the SDK will parent correctly. Under async dispatch, thread-pool reuse, or message-queue hops, this assumption silently breaks...",
    "operational_effect": "When the guardrail is in place, the operational consequences are concrete: - **Token accounting becomes additive and correct.** Because the task root is single and shared-prefix tokens are tagged as cache reads, the sum over the task's trace equals the bill. The double-count disappears. - **Causal reconstruction survives propagation loss.** Even when a hando..."
  },
  "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": "7019aacdd145acac1196908e6a74cc1f6b039096d86c735e83676dde40261a44",
    "verified_classes": [
      "TracePropagationError",
      "InboundContext"
    ],
    "verified_functions": [
      "begin_agent_span",
      "account_completion_tokens"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "TracePropagationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
