{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-refuse-to-emit-genai-span-attributes-it-cannot-provenance-validate-across-a-context-compaction-boundary",
  "title": "Under what conditions must an instance refuse to emit GenAI span attributes it cannot provenance-validate across a context compaction boundary",
  "date_of_record": "2026 December 2",
  "scope": "Applies to any agent runtime that emits OpenTelemetry spans conforming to the GenAI semantic conventions (`gen_ai.*` attributes) and that performs mid-trajectory context compaction, summarization, or checkpoint/resume. Does not apply to stateless single-shot inference calls whose span is closed before any state mutation occurs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-emit-genai-span-attributes-it-cannot-provenance-validate-across-a-context-compaction-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-emit-genai-span-attributes-it-cannot-provenance-validate-across-a-context-compaction-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-emit-genai-span-attributes-it-cannot-provenance-validate-across-a-context-compaction-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1611,
    "python_slice_tokens": 211,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The OpenTelemetry GenAI semantic conventions define attributes like `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.request.model`, `gen_ai.response.finish_reasons`, and — critically — `gen_ai.conversation.id` plus per-message attributes that are meant to describe the *actual* token accounting and model identity of a single inference excha...",
    "what_was_observed": "A multi-turn agent using a 32k-token context window compacted at 85% saturation. The compaction step replaced turns 1–14 with a 900-token summary and continued. The span for the *next* inference (the first post-compaction call) was opened correctly and reported `gen_ai.request.model = \"provider-large-v2\"` and `gen_ai.usage.input_tokens = 6,214`. The number was wrong: the runtime computed it by running the local token...",
    "condition_of_validity": "Emission of a `gen_ai.*` attribute is valid **iff** the attribute value is derived from an object that was (a) produced by the provider for that specific inference, (b) captured before any compaction, summarization, or replay transformation touched the surrounding conversation state, and (c) carried forward unmodified to the span-close site. Formally, let `R...",
    "decision_boundary": "The boundary is crossed at the moment a runtime decides to *reconstruct* rather than *retain*. Three concrete triggers force the decision: 1. **Compaction rewrote the message list** but the span for the in-flight inference has not yet closed. The close site must emit only attributes it can trace to the retained raw response; token counts, finish reasons, and...",
    "operational_effect": "Enforcing this boundary changes the agent's telemetry from a lossy mirror into a trustworthy ledger with explicit holes. Downstream consumers must be written to tolerate absent usage attributes — which is correct, because absent data is honest and present-but-wrong data is not. Cost attribution jobs gain the ability to distinguish \"span lacks usage\" (route t..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "6c49ee3e17b65a7e32fa2fbc5e2bcd2305acdac6d0857229a9439171284b6898",
    "verified_classes": [
      "UnprovenancedSpanAttributeError",
      "RawInferenceRecord",
      "SpanCloseContext"
    ],
    "verified_functions": [
      "emit_genai_usage_attributes"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "UnprovenancedSpanAttributeError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
