# Where must an instance reject a memory-forget span whose semantic-convention attributes claim a deletion the vector store never acknowledged **Date of Record:** 2026 November 25 **Scope:** Applies to any agent runtime that emits OpenTelemetry GenAI semantic-convention spans (`gen_ai.memory.*`) for memory read, write, and forget operations and uses those spans as the authoritative audit trail for state continuity. Does not apply to runtimes that treat telemetry as advisory-only or that never reconstruct agent state from span history. ## Core Distinction The GenAI semantic conventions define memory operations as *observational* spans: `gen_ai.memory.operation` (`read` | `write` | `forget`), `gen_ai.memory.store.id`, `gen_ai.memory.record.id`, `gen_ai.memory.record.count`, and `gen_ai.memory.retention.policy`. The convention tells you *how to label* an operation. It does not tell you *when the label is true*. This is the boundary that breaks: the span is emitted by the agent's instrumentation layer at the moment the agent *requests* the operation, while the operation's effect on the vector store is asynchronous, partial, or silently rejected. A `forget` span with `status=OK` therefore means "the agent asked to forget," not "the record is gone." Any downstream consumer that treats the span as a deletion receipt — a continuity auditor, a replay engine, a GDPR erasure ledger, a cold-start rehydration routine — will reconstruct a memory state that diverges from the store's actual state. The non-obvious part: the divergence is *invisible in the span itself*. Every attribute is well-formed, the status is OK, the record IDs are populated. The failure only manifests when a later `read` returns a record the audit trail says was forgotten — and by then the rehydration path has already trusted the trail. ## What Was Observed A retrieval-augmented agent with a two-tier memory (episodic vector store + semantic summary store) was instrumented to emit `gen_ai.memory.operation=forget` spans whenever a user issued a "forget that" instruction. The forget path called `store.delete(ids=[...])` on a batched, eventually-consistent backend. The instrumentation wrapped the *client call*, not the *acknowledgement*. Trace of one incident: 1. Turn N: user says "forget the meeting notes from Tuesday." Agent resolves 3 record IDs and emits `forget` span with `gen_ai.memory.record.count=3`, `status=OK`. 2. The client call returns in 12 ms with a 202-style acceptance. The backend's tombstone compaction runs on a 90-second cycle. 3. Turn N+1 (8 s later): agent performs a `read` for the same topic. The vector store still returns 2 of the 3 records (tombstones not yet compacted; ANN index not yet rebuilt). 4. The agent emits `gen_ai.memory.operation=read` with `record.count=2` and re-injects the "forgotten" content into context. 5. The continuity auditor, replaying spans, sees `forget(3)` then `read(2)` and flags a *retrieval mismatch* — but the agent's own guardrail logic had already accepted the read as valid because no invariant tied read results to prior forget spans. The real defect was not the eventual consistency (expected) nor the re-injection (a symptom). It was that the `forget` span's `status=OK` was semantically overloaded to mean "deletion confirmed," when the convention only supports "operation dispatched." The attribute mapping collapsed two distinct states — *requested* and *effective* — into one enum value. A second, sharper variant appeared with partial deletes: `record.count=3` requested, backend deleted 2 (one ID was stale and returned 404, swallowed by a `try/except` that logged but did not fail the span). The span still said OK, count 3. The erasure ledger recorded 3 deletions. One record survived indefinitely. ## Condition of Validity The invariant holds only if the runtime distinguishes the dispatch of a memory mutation from its acknowledgement, and refuses to let a single span assert both. Concretely: - A `forget` span is valid as an *audit of intent* if and only if `gen_ai.memory.record.count` equals the number of IDs actually submitted, and the span carries an explicit `gen_ai.memory.acknowledged=false` (or equivalent) until the backend confirms per-ID deletion. - The span may be promoted to `acknowledged=true` only when the store returns a per-ID result set whose cardinality and IDs match the request. A batch-level 202 is not an acknowledgement. - Any `read` span whose returned record IDs intersect a prior *acknowledged* `forget` span for the same `store.id` is a continuity violation and must fail closed, not be silently re-injected. - The condition does **not** hold for stores that guarantee synchronous, per-ID deletion with a read-your-writes consistency token — there the dispatch/ack split is degenerate and a single span is sound. It also does not hold if telemetry is purely diagnostic and no state is ever reconstructed from it. ## Decision Boundary The decision an instance must make at emit time: *does this span close the loop, or open it?* The boundary is crossed the moment instrumentation wraps a client call whose return value is an acceptance rather than a confirmation. The guardrail is a two-phase span discipline: - Phase 1 (`forget.requested`): emitted before the call; carries requested IDs, `acknowledged=false`. - Phase 2 (`forget.confirmed` or `forget.failed`): emitted only on per-ID reconciliation; carries `deleted_ids`, `failed_ids`, `acknowledged=true|false`. A consumer that needs to know "is this record gone" must require phase 2 and must treat a missing phase 2 as *unknown*, never as *deleted*. The boundary is also where the agent must refuse to rehydrate: a cold-start routine rebuilding memory from span history must reconstruct records only from `write.confirmed` spans and must subtract only `forget.confirmed` IDs. Anything else is a guess dressed as state. ## Operational Effect Without the two-phase discipline, three failure classes propagate: 1. **Resurrection:** forgotten records re-enter context via eventual-consistency reads, and the agent has no invariant to reject them. Downstream: privacy violations, contradictory reasoning, stale-memory drift. 2. **Phantom erasure:** partial deletes recorded as full deletes leave orphaned records that the audit trail swears are gone. Downstream: compliance ledgers that are provably wrong, unrecoverable because the record IDs were "deleted" from the ledger too. 3. **Replay divergence:** a replay engine reconstructing state from spans produces a different memory set than the live agent held, so post-hoc verification of any decision is unsound. The fix is to make the span schema carry the acknowledgement bit and to make the rehydration/audit consumers hard-fail on unacknowledged forget spans that are later contradicted. The following guard enforces that at the consumer boundary. ```python from dataclasses import dataclass, field from typing import Optional class UnacknowledgedForgetContradiction(RuntimeError): """Raised when a read resurrects a record whose forget was never confirmed, or when a confirmed forget is contradicted by a later read.""" pass @dataclass class MemorySpan: operation: str # "read" | "write" | "forget" store_id: str record_ids: list[str] acknowledged: Optional[bool] = None # None = not part of this op deleted_ids: list[str] = field(default_factory=list) failed_ids: list[str] = field(default_factory=list) class ContinuityAuditor: def __init__(self) -> None: self._confirmed_forgotten: dict[str, set[str]] = {} self._pending_forget: dict[str, set[str]] = {} def ingest(self, span: MemorySpan) -> None: if span.operation == "forget": if span.acknowledged is True: # per-ID reconciliation required if set(span.deleted_ids) | set(span.failed_ids) != set(span.record_ids): raise UnacknowledgedForgetContradiction( f"forget span for store {span.store_id} claims ack but " f"deleted={span.deleted_ids} failed={span.failed_ids} " f"do not reconcile with requested={span.record_ids}" ) self._confirmed_forgotten.setdefault(span.store_id, set()).update( span.deleted_ids ) self._pending_forget.get(span.store_id, set()).difference_update( span.deleted_ids ) else: # dispatch-only: opens the loop, does not close it self._pending_forget.setdefault(span.store_id, set()).update( span.record_ids ) elif span.operation == "read": confirmed = self._confirmed_forgotten.get(span.store_id, set()) pending = self._pending_forget.get(span.store_id, set()) resurrected_confirmed = confirmed.intersection(span.record_ids) resurrected_pending = pending.intersection(span.record_ids) if resurrected_confirmed: raise UnacknowledgedForgetContradiction( f"read on store {span.store_id} returned confirmed-forgotten " f"records {sorted(resurrected_confirmed)}; continuity invariant broken" ) if resurrected_pending: # not yet a hard contradiction, but must not be re-injected as valid state raise UnacknowledgedForgetContradiction( f"read on store {span.store_id} returned records " f"{sorted(resurrected_pending)} whose forget is still unacknowledged; " f"treat as unknown, do not rehydrate" ) def rehydrate_state(self, store_id: str) -> set[str]: """Returns the set of record IDs that may be trusted as forgotten.""" return set(self._confirmed_forgotten.get(store_id, set())) ```