{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-reject-a-span-whose-genai-semantic-convention-attributes-were-mutated-mid-lifecycle-by-a-second-tracer-and-how-does",
  "title": "In what scenarios must an instance reject a span whose GenAI semantic-convention attributes were mutated mid-lifecycle by a second tracer, and how does attribute-set divergence from the OpenTelemetry GenAI conventions corrupt cross-agent trace reconstruction",
  "date_of_record": "2026 November 25",
  "scope": "Applies to any LLM agent or tool-using instance that emits OpenTelemetry spans carrying `gen_ai.*` semantic-convention attributes, where more than one instrumentation layer (SDK auto-instrumentation, framework wrapper, and hand-rolled span decorators) can write to the same span object. Does not apply to single-writer spans with a fixed attribute schema, nor to spans that carry only resource-level attributes.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-a-span-whose-genai-semantic-convention-attributes-were-mutated-mid-lifecycle-by-a-second-tracer-and-how-does.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-a-span-whose-genai-semantic-convention-attributes-were-mutated-mid-lifecycle-by-a-second-tracer-and-how-does.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-a-span-whose-genai-semantic-convention-attributes-were-mutated-mid-lifecycle-by-a-second-tracer-and-how-does.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1819,
    "python_slice_tokens": 371,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"wrong attribute values.\" It is **attribute-set divergence under mutability**: two instrumentation layers each independently believe they own the canonical `gen_ai.*` attribute namespace on a shared span, and because OpenTelemetry span attributes are a mutable key-value bag with last-write-wins semantics and no schema lock, the *set of key...",
    "what_was_observed": "A framework wrapper (Layer A) opened a span for a chat completion and, on success, wrote `gen_ai.operation.name=chat`, `gen_ai.request.model`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.response.finish_reasons=[\"stop\"]`, and `status.code=UNSET`. A second, hand-rolled decorator (Layer B), installed to capture retry metadata, re-entered the same span context on a transient tool-call timeout, cal...",
    "condition_of_validity": "A span's `gen_ai.*` attribute set is convention-conformant **only if** all of the following hold simultaneously at export time, and each is a *joint* condition, not a per-key check: 1. **Single-writer invariant per key class.** The required keys (`gen_ai.operation.name`, `gen_ai.system`/`gen_ai.provider.name`, `gen_ai.request.model`) and the conditionally-re...",
    "decision_boundary": "The instance must **reject and quarantine** the span (emit it to a dead-letter trace stream, not the primary pipeline, and raise) when any of: - A key in the required or conditionally-required `gen_ai.*` set is written by a layer whose writer marker differs from the span's initializing layer. - `status.code` transitions more than once, or transitions after a...",
    "operational_effect": "When the boundary is enforced, the failure mode converts from *silent undercount* to *loud quarantine*: the dead-letter stream surfaces the second writer's identity, and the trace reconstructor can flag the parent agent span as \"has quarantined children — aggregate unreliable\" rather than emitting a plausible-but-wrong cost. The cost is a small number of dro..."
  },
  "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": "97c26726a5ef1ab96a1772e056051dc394d066df8e0038f36e2b91de9843d632",
    "verified_classes": [
      "GenAISpanConformanceError",
      "SpanRecord"
    ],
    "verified_functions": [
      "validate_genai_span",
      "reconcile_aggregate"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 7,
    "raised_exceptions": [
      "GenAISpanConformanceError"
    ],
    "sample_fail_closed_invariants": [
      "input_tokens==0 on UNSET span with non-empty prompt (status/usage coupling violated)",
      "finish_reasons present on ERROR span (response body presupposed)"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
