{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-reject-a-genai-agent-span-whose-tool-call-attributes-were-re-parented-across-a-model-invocation-boundary",
  "title": "In what scenarios must an instance reject a GenAI agent span whose tool-call attributes were re-parented across a model invocation boundary",
  "date_of_record": "2026 November 21",
  "scope": "Applies to OTel-instrumented LLM agent runtimes that emit `gen_ai.*` spans where a single logical agent turn contains one or more `gen_ai.tool.call` child spans nested under a `gen_ai.chat`/model-invocation span. Does not apply to single-shot completion calls with no tool loop, nor to purely trace-only deployments where span parentage is not consumed by a downstream verifier.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-a-genai-agent-span-whose-tool-call-attributes-were-re-parented-across-a-model-invocation-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-a-genai-agent-span-whose-tool-call-attributes-were-re-parented-across-a-model-invocation-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-a-genai-agent-span-whose-tool-call-attributes-were-re-parented-across-a-model-invocation-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2012,
    "python_slice_tokens": 386,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"a span was dropped\" or \"an attribute was missing.\" It is a **parentage/attribute coherence violation**: the OpenTelemetry GenAI semantic conventions bind certain attributes to a span *by virtue of what that span represents*. Specifically, `gen_ai.operation.name`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, and the tool...",
    "what_was_observed": "A ReAct-style agent was instrumented with a single `gen_ai.chat` span opened at the start of the turn and closed after the final answer. Inside it, the loop: 1. calls the model (`gen_ai.operation.name = \"chat\"`), 2. reads `tool_calls` from the response, 3. opens a `gen_ai.tool.call` span per tool, executes it, closes it, 4. appends the tool result to messages and calls the model again, 5. repeats until `finish_reason...",
    "condition_of_validity": "The GenAI semantic conventions are coherent **only when the span that owns `gen_ai.usage.*` and `gen_ai.operation.name = \"chat\"` corresponds to exactly one model invocation**. The invariant is: > A `gen_ai.chat` span is a 1:1 record of a single request/response exchange with a model endpoint. Its `gen_ai.usage.*` attributes are the usage reported by that exc...",
    "decision_boundary": "An instance must **reject** (not merely flag) a GenAI span when the following is detectable at export or ingest time: - `gen_ai.usage.input_tokens` or `output_tokens` was set more than once on the same span (monotonicity violation — accumulation), **or** - a `gen_ai.tool.call` span's `parent_span_id` resolves to a `gen_ai.chat` span whose `gen_ai.usage.outpu...",
    "operational_effect": "When the invariant is enforced, three things become true that were not before: 1. **Token metrics normalize correctly.** Summing `gen_ai.usage.input_tokens` over `gen_ai.chat` spans equals actual billed input tokens, because each span is single-writer. The 4× overcount disappears without any downstream dedup logic. 2. **Loop depth is recoverable from trace s..."
  },
  "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": "be9d7af86d958a68aaf99f0addebd23b79ad25f01cfaf2f42328c4cc30cc9c6e",
    "verified_classes": [
      "GenAISpanInvariantError",
      "GenAISpan"
    ],
    "verified_functions": [
      "validate_genai_span",
      "normalize_turn_usage"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "GenAISpanInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
