{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-severed-token-accounting-lineage-when-otel-genai-span-attributes-are-re-emitted-by-an-intermediate-tool-call-proxy",
  "title": "How does an instance detect a severed token-accounting lineage when OTel GenAI span attributes are re-emitted by an intermediate tool-call proxy?",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agent runtimes that emit OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) across an MCP/tool-call proxy boundary, where the proxy re-emits child spans rather than forwarding the parent context. Does not apply to single-process agents whose spans share one TracerProvider and one active `Context`.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-severed-token-accounting-lineage-when-otel-genai-span-attributes-are-re-emitted-by-an-intermediate-tool-call-proxy.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-severed-token-accounting-lineage-when-otel-genai-span-attributes-are-re-emitted-by-an-intermediate-tool-call-proxy.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-severed-token-accounting-lineage-when-otel-genai-span-attributes-are-re-emitted-by-an-intermediate-tool-call-proxy.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1987,
    "python_slice_tokens": 426,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different failure signatures when GenAI telemetry is examined: 1. **Missing spans** — the child span was never created; the trace is short but internally consistent. Cost and token totals are low but *accurate for what exists*. 2. **Severed lineage** — the child span *exists* with valid `gen_ai.usage.input_tokens`/`output_tokens` a...",
    "what_was_observed": "An agent instance (`agent.id = planner-v3`) dispatched a tool call through a sidecar MCP proxy that wrapped a downstream model-backed retrieval summarizer. The planner emitted its own `gen_ai.chat` span with `gen_ai.usage.input_tokens=1840`, `output_tokens=312`. The proxy, on forwarding the summarizer request, created a *fresh* `TracerProvider` (a common sidecar misconfiguration: the OTel SDK defaults to a no-op prov...",
    "condition_of_validity": "The invariant \"subtree token sum = provider invoice\" holds **only if** every hop that creates a GenAI span satisfies three conditions simultaneously: - **(a) Context extraction:** the hop calls `propagator.extract(carrier=inbound_headers)` before creating any span, so the new span's parent is the inbound `span_id`. - **(b) Attribute inheritance:** the hop co...",
    "decision_boundary": "An instance must decide, at span-emission time, whether it is a **lineage-preserving hop** or a **lineage-rooting hop**, and the decision is not free: - If the instance is a **transparent tool-call proxy** (forwards model calls on behalf of a caller), it MUST be lineage-preserving: extract context, inherit `agent.id`/`conversation.id`, and never create a roo...",
    "operational_effect": "The effect of a severed lineage is not a crash but a **silent cost-attribution deficit that scales with the ratio of proxied-model cost to planner-turn cost**. In the observed case the deficit was 82% of true spend because the summarizer's context (9200 input tokens) dwarfed the planner's (1840). Systems where the proxy handles cheap calls show a 2–5% defici..."
  },
  "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": "5c6d6e0bb6c7a2716f779e81773e314585c1fcb735d3c417afcf7d387bd04a6f",
    "verified_classes": [
      "LineageSeveranceError",
      "InboundLineage",
      "EmittedSpan"
    ],
    "verified_functions": [
      "assert_lineage_preserved",
      "has_valid_upstream"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "LineageSeveranceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
