{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-reject-an-opentelemetry-genai-span-whose-gen-ai-usage-input-tokens-was-inherited-from-a-parent-agent-span-rathe",
  "title": "Under what conditions must an instance reject an OpenTelemetry GenAI span whose `gen_ai.usage.input_tokens` was inherited from a parent agent span rather than measured at the invocation boundary",
  "date_of_record": "2026 November 28",
  "scope": "Applies to any agent runtime that emits OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) where nested agent/tool invocations may share a parent span or propagate usage attributes downward. Does not apply to single-shot, single-span model calls with no parent-child span nesting.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-an-opentelemetry-genai-span-whose-gen-ai-usage-input-tokens-was-inherited-from-a-parent-agent-span-rathe.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-an-opentelemetry-genai-span-whose-gen-ai-usage-input-tokens-was-inherited-from-a-parent-agent-span-rathe.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-an-opentelemetry-genai-span-whose-gen-ai-usage-input-tokens-was-inherited-from-a-parent-agent-span-rathe.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2344,
    "python_slice_tokens": 460,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things that can carry a token count on a GenAI span, and they are routinely conflated by agent frameworks: 1. **Measured usage** — a count obtained from the model provider's response envelope (`usage.input_tokens`, `usage.prompt_tokens`, `usage.cache_read_input_tokens`, etc.) at the exact invocation boundary, attributable...",
    "what_was_observed": "A planner agent (span `agent.plan`, model `gpt-class-A`) dispatches three sequential sub-agent invocations (`agent.subtask[0..2]`, model `gpt-class-B`) under a shared parent trace. The tracing wrapper used was configured with `propagate_parent_attributes=True` to ensure `gen_ai.conversation.id` and `gen_ai.system` flowed down. The attribute filter was a substring match on `gen_ai.` — so `gen_ai.usage.input_tokens` fl...",
    "condition_of_validity": "A `gen_ai.usage.*` attribute on a span is valid as a control signal if and only if all three hold: 1. **Boundary provenance.** The value was written by the code path that received the provider response, not by an attribute-inheritance mechanism. In OpenTelemetry terms: the attribute must be set via `span.set_attribute(...)` on the span that directly wraps th...",
    "decision_boundary": "The decision an instrumentation or guard layer must make is: **on span emission, do I trust `gen_ai.usage.input_tokens` as the local invocation's count?** The boundary is crossed when the attribute was present at span creation (inherited) rather than set after the provider response (measured). The detection is mechanical and cheap: - Capture the span's attri...",
    "operational_effect": "Enforcing the invariant changes three behaviors: 1. **Budget guards become per-invocation.** The subtask[1] downgrade in the observed trace would not have fired, because the inherited value fails condition (a) and the guard falls back to the measured 2,877, which is under the 3,000 limit. The model stays `gpt-class-B`, the cache survives, and the reasoning d..."
  },
  "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": "5fd37cc88f1d5288279173da2af8174468a89fa8c33e1f271ed260f94bd4406e",
    "verified_classes": [
      "UsageAdmissibilityError",
      "UsageSource",
      "SpanSnapshot"
    ],
    "verified_functions": [
      "classify_usage_source",
      "admissible_input_tokens",
      "enforce_budget"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "UsageAdmissibilityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
