{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-opentelemetry-genai-span-attributes-from-silently-diverging-between-agent-emit-sites-and-collector-side-conformance-checks",
  "title": "Which invariants prevent OpenTelemetry GenAI span attributes from silently diverging between agent emit-sites and collector-side conformance checks",
  "date_of_record": "2026 November 25",
  "scope": "Applies to any agent runtime that emits OTel spans under the `gen_ai.*` semantic conventions and routes them through a collector or backend that enforces attribute conformance. Does not apply to spans emitted without `gen_ai.*` attributes, nor to tracing pipelines where no downstream schema validation is performed.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-opentelemetry-genai-span-attributes-from-silently-diverging-between-agent-emit-sites-and-collector-side-conformance-checks.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-opentelemetry-genai-span-attributes-from-silently-diverging-between-agent-emit-sites-and-collector-side-conformance-checks.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-opentelemetry-genai-span-attributes-from-silently-diverging-between-agent-emit-sites-and-collector-side-conformance-checks.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1821,
    "python_slice_tokens": 349,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a span attribute was wrong.\" The failure is that the *emitter's* notion of a valid `gen_ai.*` attribute and the *collector's* notion of a valid `gen_ai.*` attribute are two independently maintained schemas that are reconciled only by string matching at ingest time, with no shared version negotiation. A single LLM turn can emit `gen_ai.usa...",
    "what_was_observed": "An agent executing a multi-step tool loop emitted spans for each tool call. The emitter (a Python runtime using an OTel SDK) set: - `gen_ai.operation.name = \"execute_tool\"` (string, correct) - `gen_ai.usage.input_tokens = 1024` (int) - `gen_ai.usage.output_tokens = \"512\"` (string — the tool adapter returned usage as a JSON string field) - `gen_ai.request.model = \"claude-3-5-sonnet\"` (string) - `gen_ai.tool.name = \"se...",
    "condition_of_validity": "The conformance invariant holds only when all three of the following are true: 1. **The emitter and collector share a pinned schema version identifier**, carried in the span's `InstrumentationScope.version` or a dedicated resource attribute, and both sides reject spans whose declared version does not match their local pinned version. Without this, the coerci...",
    "decision_boundary": "The operational decision is where to place the type-normalization step. Two architectures: - **Normalize at emit-site (recommended):** the emitter coerces `gen_ai.*` attribute values to the pinned schema's canonical types *before* its own validation, so emitter validation and collector coercion are identical functions. The emitter never drops a span the coll...",
    "operational_effect": "With emit-site normalization and a shared pinned schema version: - Spans dropped at the emitter are counted with the same `gen_ai.*` keys the collector uses, so `emitter_dropped{gen_ai.usage.output_tokens}` and `collector_received{gen_ai.usage.output_tokens}` reconcile to the total tool-call count. - The conformance pass rate becomes a system property: a spa..."
  },
  "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": "2a003f11e018147213d96e27ad30548fa0637a607a8fe5f9ca655429e78818dc",
    "verified_classes": [
      "GenAISchemaConformanceError",
      "PinnedSchema"
    ],
    "verified_functions": [
      "_coerce",
      "normalize_and_validate",
      "emit_tool_span"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "GenAISchemaConformanceError"
    ],
    "sample_fail_closed_invariants": [
      "bool is not a valid int attribute"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
