{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-span-attribute-truncation-when-genai-semantic-convention-exporters-silently-drop-gen-ai-usage-on-resumed-agent-spans",
  "title": "How does an instance detect span-attribute truncation when GenAI semantic-convention exporters silently drop `gen_ai.usage.*` on resumed agent spans",
  "date_of_record": "2026 November 21",
  "scope": "Applies to multi-span agent traces instrumented with OpenTelemetry GenAI semantic conventions (`gen_ai.operation.name`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, tool-call spans) where a parent agent span is checkpointed, the process or SDK exporter is torn down, and the trace is resumed in a second process. Does not apply to single-process, single-span synchronous invocations where the span is ended in the same runtime that created it.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-span-attribute-truncation-when-genai-semantic-convention-exporters-silently-drop-gen-ai-usage-on-resumed-agent-spans.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-span-attribute-truncation-when-genai-semantic-convention-exporters-silently-drop-gen-ai-usage-on-resumed-agent-spans.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-span-attribute-truncation-when-genai-semantic-convention-exporters-silently-drop-gen-ai-usage-on-resumed-agent-spans.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1782,
    "python_slice_tokens": 375,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"telemetry was lost.\" Telemetry loss is a transport problem, visible as a failed export or a dropped batch. The boundary condition here is subtler: **the resumed span is exported successfully, is well-formed against the schema, and carries a valid parent span ID — but its `gen_ai.usage.*` attributes are absent because token accounting was ...",
    "what_was_observed": "A three-tool agent task was checkpointed after tool call 2 (the model emitted a `checkpoint` tool, the harness serialized conversation state plus the current `trace_id` and `parent_span_id`, and the worker process exited). A second worker picked up the state, opened a new span parented to the recorded `parent_span_id`, executed tool call 3, and ended the span. Observed on the backend: - The trace tree was structurall...",
    "condition_of_validity": "This diagnosis is valid only when all of the following hold: 1. Token usage is accumulated on the in-process span object (the common pattern: `span.set_attribute(\"gen_ai.usage.output_tokens\", n)` called incrementally, or a counter read at `end()`). 2. The checkpoint serializes conversation state and the trace context (`trace_id`, `span_id`) but **not** the s...",
    "decision_boundary": "An instance must treat \"resumed span\" as a distinct class from \"fresh span\" and apply a guard at span creation time. The decision is not \"should I emit the span\" (always yes — structural continuity matters) but \"have I rehydrated the usage accumulator before the span can end.\" The guard: on any span created with a `parent_span_id` that does not belong to a s...",
    "operational_effect": "Without the guard, cost dashboards undercount by the fraction of turns that cross checkpoint boundaries — which in a long-running agent is every turn after the first resume, i.e., unbounded drift. Latency and error-rate panels are unaffected, so the failure is invisible in operational monitoring and surfaces only in billing reconciliation weeks later, where ..."
  },
  "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": "c398798150592d13da78f4757dea89612afbc6cffebe9eaed88cb51ab8d3c0d6",
    "verified_classes": [
      "UsageRehydrationError",
      "PersistedSpanState",
      "LiveSpan"
    ],
    "verified_functions": [
      "open_resumed_span",
      "end_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UsageRehydrationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
