{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-token-accounting-lineage-collapse-when-opentelemetry-genai-spans-are-re-parented-across-agent-handoffs",
  "title": "What structural signals indicate token-accounting lineage collapse when OpenTelemetry GenAI spans are re-parented across agent handoffs",
  "date_of_record": "2026 November 24",
  "scope": "Applies to multi-agent systems emitting OpenTelemetry GenAI semantic convention spans (`gen_ai.*` attributes) where a child agent inherits a parent's span context via context propagation (W3C traceparent) across an A2A/MCP handoff, and where token usage is aggregated per-trace for billing or budget enforcement. Does not apply to single-agent traces with a single root span, nor to systems that emit flat, unparented spans with externally reconciled IDs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-token-accounting-lineage-collapse-when-opentelemetry-genai-spans-are-re-parented-across-agent-handoffs.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-token-accounting-lineage-collapse-when-opentelemetry-genai-spans-are-re-parented-across-agent-handoffs.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-token-accounting-lineage-collapse-when-opentelemetry-genai-spans-are-re-parented-across-agent-handoffs.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1761,
    "python_slice_tokens": 275,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There is a difference between *trace topology* (who called whom, encoded in `parent_span_id`) and *cost topology* (who consumed which tokens, encoded in `gen_ai.usage.input_tokens` / `gen_ai.usage.output_tokens`). The GenAI semantic conventions assume these two topologies are congruent: a span's token usage is attributed to the agent that owns the span, and ...",
    "what_was_observed": "A three-agent pipeline — planner (A), executor (B), auditor (C) — was instrumented with GenAI spans. B was invoked by A via an A2A handoff that carried the W3C `traceparent`. B, in turn, invoked C via MCP tool call. The intended topology was a clean chain: `span_A → span_B → span_C`. What actually exported: - `span_B` carried `parent_span_id = span_A.span_id` correctly, but its `gen_ai.usage.input_tokens` included th...",
    "condition_of_validity": "The invariant holds — usage attributes are congruent with parent-child topology — only under three simultaneous conditions: 1. **Every span that performs a model invocation carries a non-zero `gen_ai.usage.input_tokens`.** A span with a `gen_ai.request.model` attribute and `status.code == OK` but zero input tokens is invalid; the model was called, so input w...",
    "decision_boundary": "The boundary is between **re-parenting for topology** and **re-attributing for cost**. These are separate operations and must be performed separately: - **Re-parent** when a span's causal trigger changes (e.g., B's span is re-pointed from A to a retry-wrapper span). This changes `parent_span_id` only. - **Re-attribute** when the agent that bears the token co...",
    "operational_effect": "The downstream effect is a **budget-enforcement inversion**. Per-agent token budgets are computed by summing `gen_ai.usage.*` over spans whose `parent_span_id` chain resolves to that agent's root. When lineage collapses: - The delegating agent (B) appears to consume the delegate's (C's) input tokens, inflating B's apparent spend by the delegate's prompt size..."
  },
  "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": "d884a04a0a7eefdd580a3998a236bcaea767e7e783bb613fab9acea65e1347de",
    "verified_classes": [
      "LineageCollapseError"
    ],
    "verified_functions": [
      "validate_genai_lineage",
      "rollup_per_agent"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "LineageCollapseError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
