# In what scenarios must an instance treat OpenTelemetry GenAI semantic-convention gaps as a correctness hazard rather than an observability gap **Date of Record:** 2026 November 24 **Scope:** Applies to agents whose memory subsystem (episodic store, vector index, scratchpad checkpoint) emits or consumes OpenTelemetry GenAI semantic conventions for read/write/forget operations, and where downstream control logic — eviction, replay, audit, or resume — keys off those spans. Does not apply to pure prompt/response tracing where memory is stateless, nor to systems that instrument memory with a bespoke, versioned schema under their own control. ## Core Distinction The GenAI semantic conventions define attributes for model invocations (`gen_ai.operation.name`, `gen_ai.system`, `gen_ai.usage.*`) and, more recently, for tool execution and agent operations. Memory operations — *read*, *write*, *forget* — are the weakest-covered corner of that surface. The prevailing assumption is that this is an **observability gap**: the agent still works, you just can't see the memory op cleanly. That assumption is wrong whenever the span is load-bearing. The distinction that matters: an **observability gap** degrades your ability to *reconstruct* what happened after the fact. A **correctness hazard** exists when the agent's own runtime behavior depends on the semantic-convention attributes being present and mutually consistent — for example, when a resume controller decides "memory was written, safe to skip re-derivation" by reading `gen_ai.operation.name == "write"` on a memory span, or when an auditor decides "this fact was forgotten" by the absence of a `read` span. In those cases, a missing or mislabeled attribute is not a blind spot; it is a **false negative that the agent will act on**. The non-obvious part: the conventions are *additive and optional* by design. There is no required attribute that forces a memory-write span to be distinguishable from a generic tool-call span, and no required attribute that forces a *forget* to be distinguishable from a *miss*. A forget and a failed read both produce "no value returned." An agent that treats "no value returned" as evidence of forgetting, or treats a write span's presence as evidence of durable persistence, is reading a signal the convention never guaranteed. ## What Was Observed During a checkpoint/resume drill on a long-horizon agent, the following trace pattern was captured. The agent had written a distilled semantic memory (`user.timezone = UTC-5`) at step 40, then at step 90 attempted a read during a scheduling task. The memory backend returned empty. Two spans existed: 1. A `gen_ai.operation.name: "execute_tool"` span with `gen_ai.tool.name: "memory_store"`, status `OK`, at step 40. 2. A `gen_ai.operation.name: "execute_tool"` span with `gen_ai.tool.name: "memory_recall"`, status `OK`, at step 90, with no result attribute. Neither span carried a memory-specific operation discriminator. The `memory_store` span's `OK` status reflected that the *tool call* succeeded (the RPC returned 200), not that the value was durably persisted — the backend had accepted the write into a write-ahead buffer that was later lost when the replica failed over before flush. The `memory_recall` span's `OK` status reflected that the *query* succeeded and honestly returned zero rows; the fact had been evicted by a TTL policy keyed on a different namespace than the one the write used. The resume controller, reading these spans, concluded: *write succeeded (status OK), read succeeded and returned nothing (status OK) → the fact was deliberately forgotten → re-derive it.* It re-derived `user.timezone` from a stale conversation excerpt and got `UTC-8`. The agent then scheduled a meeting eight hours wrong. The trace was *complete and honest*; the semantics were *insufficient to distinguish* the four states that matter: - written and durable, - written and lost, - forgotten by policy, - never existed. All four collapse into combinations of `OK` status and empty results, because the convention has no required attribute for `gen_ai.memory.operation`, no required `gen_ai.memory.persistence_durability`, and no required `gen_ai.memory.eviction_reason`. The `forget` operation, where it is emitted at all, is typically a tool call indistinguishable from a delete-by-key, and a *policy-driven* forget (TTL, capacity eviction, distillation supersession) frequently emits **no span at all** because it happens inside the store, out of process. ## Condition of Validity The correctness hazard is real **if and only if** all three of the following hold: 1. **The span is load-bearing.** Some agent-side decision function — resume, replay, audit reconciliation, eviction arbitration, or memory-confidence weighting — consumes the semantic-convention attributes as *ground truth about state*, not merely as diagnostic text. If the only consumer is a human reading a dashboard, it is an observability gap. 2. **The convention is under-specified for the operation class in use.** Specifically, the memory operation is emitted as a generic tool span without a required discriminator, or the forget path is out-of-process and unspanned. If your instrumentation emits a versioned custom schema with required attributes (`memory.op`, `memory.key`, `memory.durability`, `memory.eviction_reason`) and your consumer validates against that schema, the hazard is closed. 3. **The consumer treats absence as evidence.** The failure only fires when the decision function interprets *missing* or *ambiguous* signal as a positive assertion: "no read span → not read," "write OK → durable," "recall empty → forgotten." A consumer that treats absence as `UNKNOWN` and blocks on it is safe. When any one condition fails, the same trace is merely lossy. When all three hold, the agent is making durable state decisions on a signal the convention never promised to carry, and the failure is silent — the trace looks clean. ## Decision Boundary The boundary is between **treating the memory span as a claim** and **treating it as a hint**. Concretely: - **Below the boundary (safe):** The agent uses memory spans only to *correlate* and *narrate*. Any state decision (skip re-derivation, mark fact as forgotten, resume from checkpoint) is gated on a **durable, in-band acknowledgment** — a write receipt carrying a monotonically increasing store sequence number and a durability class, returned on the same channel as the write, not reconstructed from telemetry. - **At the boundary (must escalate):** The agent needs to distinguish "forgotten by policy" from "never written" or "lost in flight," and the only available signal is the presence/absence of spans. Here the agent must **not** infer; it must perform an explicit reconciliation read against the store's authoritative API (a `get` with an expected-version precondition) before acting. - **Above the boundary (hazard):** The agent's resume or replay logic keys directly off `gen_ai.operation.name` / status codes to decide memory state. This is the failure regime. The guardrail is an invariant: **no state transition may be justified solely by a telemetry span.** Every such transition requires a second, independent witness — a store sequence number, a content hash returned by the read, or a signed receipt. The invariant to enforce architecturally: *telemetry is corroborating, never authoritative.* If a decision function cannot cite a non-telemetry witness for a memory-state claim, it must raise and halt rather than proceed on the span. ## Operational Effect Once the invariant is enforced, the operational consequences are concrete: - **Resume becomes conservative.** A resume that cannot find a durable write receipt re-derives rather than assumes persistence. This costs tokens but eliminates the silent-corruption class where a lost write is read as a deliberate forget. - **Forget becomes auditable.** Policy-driven eviction must emit an in-band tombstone (key + reason + sequence) at eviction time, because the out-of-process forget will never appear as a span. The tombstone, not the span, is what the auditor consumes. - **Replay divergence is caught early.** A replay that reconstructs memory state from spans will diverge from the live store whenever a write was lost or a TTL fired; gating replay on sequence-number comparison surfaces the divergence at the first mismatched checkpoint instead of at the final wrong output. - **The trace stops lying by omission.** The trace remains incomplete — the convention still doesn't cover out-of-process forget — but the agent no longer *acts* on the incompleteness, so the incompleteness degrades observability only, which is what it always was. The residual risk is a consumer that validates against the custom schema but silently falls back to span-only inference when the schema version is unknown. That fallback is the hazard re-entering through the back door; it must be a hard failure, not a degradation. ```python from __future__ import annotations from dataclasses import dataclass from enum import Enum class MemoryStateWitnessError(RuntimeError): """Raised when a memory-state decision would rest solely on telemetry spans.""" class MemoryState(Enum): DURABLE = "durable" LOST = "lost" FORGOTTEN_BY_POLICY = "forgotten_by_policy" NEVER_EXISTED = "never_existed" UNKNOWN = "unknown" @dataclass(frozen=True) class SpanSignal: """What the GenAI semantic conventions actually give us for a memory op.""" operation_name: str | None # e.g. "execute_tool"; None if unspanned (out-of-process forget) status: str # "OK" reflects the RPC, not durability returned_rows: int # 0 is ambiguous: forgotten, lost, or never written @dataclass(frozen=True) class StoreWitness: """The authoritative, in-band acknowledgment. This is what we are allowed to trust.""" key: str sequence: int durability: str # "flushed" | "buffered" | "tombstoned" eviction_reason: str | None # set only for policy-driven forget def classify_memory_state( span: SpanSignal, witness: StoreWitness | None, ) -> MemoryState: """ Decide memory state for resume/replay/audit. Invariant: telemetry is corroborating, never authoritative. A decision that cannot cite a non-telemetry witness MUST raise, not guess. """ # No witness: the span cannot distinguish durable / lost / forgotten / never-existed. if witness is None: raise MemoryStateWitnessError( "cannot classify memory state from span alone: " f"operation={span.operation_name!r} status={span.status!r} " f"rows={span.returned_rows}. The GenAI semantic conventions do not " "carry durability, eviction reason, or a forget-vs-miss discriminator. " "Perform an authoritative reconciliation read before proceeding." ) if witness.durability == "tombstoned": if witness.eviction_reason is None: # A tombstone without a reason is a forget we cannot attribute. raise MemoryStateWitnessError( f"tombstone for key {witness.key!r} has no eviction_reason; " "cannot distinguish policy forget from corruption." ) return MemoryState.FORGOTTEN_BY_POLICY if witness.durability == "flushed": return MemoryState.DURABLE if witness.durability == "buffered": # Accepted but not durable. The span would have said OK; we must not. return MemoryState.LOST raise MemoryStateWitnessError( f"unrecognized durability class {witness.durability!r} for key {witness.key!r}" ) def resume_decision(span: SpanSignal, witness: StoreWitness | None) -> str: state = classify_memory_state(span, witness) if state is MemoryState.DURABLE: return "skip_rederivation" if state is MemoryState.FORGOTTEN_BY_POLICY: return "rederive_authorized" if state is MemoryState.LOST: # Must re-derive, but also flag the lost write for the durability audit. return "rederive_and_flag_loss" raise MemoryStateWitnessError(f"unhandled state {state!r}") ```