{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-inherit-a-parent-span-s-token-accounting-across-a-federated-agent-trace",
  "title": "When must an instance refuse to inherit a parent span's token accounting across a federated agent trace",
  "date_of_record": "2026 November 30",
  "scope": "Applies to multi-agent systems where OpenTelemetry GenAI spans (`gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.operation.name`) are stitched across process boundaries via W3C `traceparent` propagation and merged into a single trace for cost/latency attribution. Does not apply to single-process, single-agent instrumentation where span parentage is unambiguous.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-inherit-a-parent-span-s-token-accounting-across-a-federated-agent-trace.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-inherit-a-parent-span-s-token-accounting-across-a-federated-agent-trace.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-inherit-a-parent-span-s-token-accounting-across-a-federated-agent-trace.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1410,
    "python_slice_tokens": 237,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing spans\" or \"clock skew.\" It is the **silent double-counting of token usage when a child agent re-emits its own `gen_ai.usage.*` attributes onto a span whose parent already declared the same consumption**, because the child was invoked by a router that had *pre-charged* the parent span with an estimated budget rather than actuals. T...",
    "what_was_observed": "A three-tier agent topology: an orchestrator (A) delegates to a router (B), which fans out to worker instances (C1..Cn). Instrumentation was added at A to emit a `gen_ai.chat` span with `gen_ai.usage.input_tokens` set to the *prompt budget estimate* (e.g., 8192) before the call, then updated on completion. B, receiving the `traceparent`, created child spans and — correctly — emitted its own actual `gen_ai.usage.*` fr...",
    "condition_of_validity": "The double-count is only possible when three conditions co-occur: 1. **Provisional usage emission.** A parent span sets `gen_ai.usage.*` before its children exist (budget reservation, pre-flight estimate, or a streaming partial that is later overwritten rather than replaced). 2. **Federation merge without span-kind discrimination.** The aggregator treats eve...",
    "decision_boundary": "An instance must **refuse to inherit** parent token accounting — i.e., must emit its own usage as a *replacement*, not an *addition*, and must mark the parent's provisional usage as superseded — when and only when: - The parent span's `gen_ai.usage.*` was set *before* the child's span start timestamp (provisional), **and** - The child's `gen_ai.operation.nam...",
    "operational_effect": "Without the guardrail, cost attribution is non-monotonic in fan-out: the more tiers, the larger the multiplier, and the multiplier is invisible because each tier's dashboard looks internally consistent. Teams chasing a \"cost spike\" will find it correlates with routing depth, not with token volume — a diagnostic signature that points at the merge algebra, not..."
  },
  "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": "7303301ad3a9bd25bb517f1a533cdb0f144b48e105237e924609e60c018da631",
    "verified_classes": [
      "AttributionInvariantError",
      "Span"
    ],
    "verified_functions": [
      "reconcile_trace"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "AttributionInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
