{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-reconcile-opentelemetry-genai-token-accounting-spans-when-a-delegated-sub-agent-re-emits-the-parent-s-prompt-pr",
  "title": "Under what conditions must an instance reconcile OpenTelemetry GenAI token-accounting spans when a delegated sub-agent re-emits the parent's prompt prefix across a trace boundary",
  "date_of_record": "2026 November 28",
  "scope": "Applies to agent runtimes that emit `gen_ai.*` spans per the OpenTelemetry GenAI semantic conventions and aggregate `gen_ai.usage.input_tokens` / `gen_ai.usage.output_tokens` across a multi-agent trace (parent orchestrator → delegated sub-agent → tool calls). Does not apply to single-model, single-span inference calls where no delegation or prefix reuse occurs, nor to billing reconciliation performed outside the trace (e.g., provider-side invoices).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reconcile-opentelemetry-genai-token-accounting-spans-when-a-delegated-sub-agent-re-emits-the-parent-s-prompt-pr.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reconcile-opentelemetry-genai-token-accounting-spans-when-a-delegated-sub-agent-re-emits-the-parent-s-prompt-pr.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reconcile-opentelemetry-genai-token-accounting-spans-when-a-delegated-sub-agent-re-emits-the-parent-s-prompt-pr.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1722,
    "python_slice_tokens": 337,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define `gen_ai.usage.input_tokens` as the token count *reported by the model provider for that specific inference call*. They deliberately do **not** define it as \"tokens attributable to this agent's logical work.\" These diverge the moment delegation involves prompt-prefix reuse: a sub-agent that inherits the orchestrator's con...",
    "what_was_observed": "A three-tier orchestrator (root → 4 parallel researchers → 1 synthesizer) over a 41,000-token shared context. Each researcher sub-agent received the full context and made a single inference call; the synthesizer received the four research outputs plus the same shared context. Raw span aggregation produced: - Root orchestrator span: `input_tokens = 41,200` (the shared prefix + directive) - 4 researcher spans: `input_t...",
    "condition_of_validity": "The naive-sum aggregation is only valid under the strict condition that **no span's input overlaps any other span's input or output within the trace** — i.e., every inference call reads a disjoint token set. This holds for embarrassingly parallel sub-agents that each receive *only* a freshly-constructed, non-overlapping slice (no shared system prompt, no sha...",
    "decision_boundary": "The runtime must choose between two postures at span-emission time: - **Attribute-and-defer (default):** emit raw provider usage verbatim, plus a custom `gen_ai.agent.parent_span_id` and a `gen_ai.input.prefix_hash` (hash of the shared prefix, computed by the runtime before the call). Downstream reconciliation can then dedupe by prefix hash. Cost: one extra ...",
    "operational_effect": "Without prefix-hash emission and a deduplicating rollup, the trace-level token accounting inflates super-linearly with fan-out and misattributes cost to the orchestrator tier (whose single 41k span looks cheap next to four 41.9k children, even though the orchestrator's context is the *cause* of all four). Budget enforcement keyed on trace-sum will trip early..."
  },
  "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": "2ae6748b4bb90c9820d0a8a1dc5422fe03ce8e8472a3adb39c7600e13049c9b6",
    "verified_classes": [
      "PrefixOverlapUnreconciled",
      "GenAISpan"
    ],
    "verified_functions": [
      "reconcile_trace_tokens",
      "publish_trace_cost"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "PrefixOverlapUnreconciled"
    ],
    "sample_fail_closed_invariants": [
      "empty trace: nothing to reconcile",
      "reconciled token total collapsed to zero; topology suspect"
    ],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
