Where must an instance halt when a scoped-delete tombstone races a concurrent memory write, and why does TTL expiry alone never satisfy deletion propagation?
**Date of Record:** 2026 December 1 **Scope:** Applies to any agent instance holding a memory tool API (`read`/`write`/`forget`) with per-scope retention classes and TTLs, where a GDPR-aligned erasure request must propagate across derived stores (episodic log, distilled semantic index, embedding cache, downstream peer replicas). Does not cover deletion of the backing object store's immutable audit log, which is governed by a separate legal-hold retention class.
Core Distinction
The failure here is not "the record still exists." It is that **deletion is a state transition on a key, while writes are state transitions on a value, and the two are ordered by different clocks.** TTL expiry is a *lazy, read-time* observation: a record past its TTL is treated as absent by a reader but is still physically present and still eligible to be resurrected by a write that lands after the expiry instant but before the reaper sweep. A forget/tombstone is an *eager, write-time* assertion: the key must never again surface a value, including values written concurrently with the erasure.
The load-bearing invariant is therefore not "TTL ≤ retention period." It is: **for any scope under erasure, no successful `write` may complete with a version that is not dominated by the tombstone's logical clock, and no `read` may return a value whose version is not dominated by the tombstone.** TTL satisfies neither half, because it carries no version and no scope lineage.
What Was Observed
An agent operating a customer-support memory scope received an erasure request for subject `S`. The runtime issued `forget(scope="subject:S", mode="propagate")`, which (a) wrote a tombstone at the scope root, (b) enqueued a reaper job to purge the episodic log and semantic index, and (c) returned `accepted` — not `committed`. The tool's contract said `accepted` means "tombstone durable; propagation asynchronous."
Meanwhile a distillation worker, mid-flight, had already `read` the pre-tombstone episodic entries for `S` and was about to `write` a distilled semantic summary. The write carried a fresh logical version (it was a *new* record, `semantic:S:summary`), so the write-path's per-key tombstone check — which only compared the tombstone against the *target key* `subject:S` — passed. The summary landed under a derived key the tombstone never named. The reaper swept `subject:S` and the episodic log, reported `purged`, and the erasure was closed. The derived summary survived, keyed to `S`, and was retrieved 40 minutes later by an unrelated agent answering a query about `S`.
Two distinct defects compounded:
- **Lineage blindness:** the tombstone named a scope root, but the write-path check was key-scoped, not lineage-scoped. Derived keys (`semantic:*`, `embedding:*`) inherit from `subject:S` but do not *contain* it in a form the check parsed.
- **Read-then-write TOCTOU:** the distillation worker's `read` was authorized against a pre-tombstone snapshot; its subsequent `write` was authorized against a post-tombstone key. The instance held a valid read warrant and a valid write warrant that were never jointly valid.
Condition of Validity
The eager-forget invariant holds only when all three conditions are simultaneously true at the moment of any `write` or `read` touching a scope under erasure:
- **C1 (lineage closure):** every derived key carries a resolvable parent pointer to its source scope, and the tombstone check walks the parent chain, not the key string.
- **C2 (clock domination):** the tombstone carries a monotonic logical version `V_t`; every write result and every read result carries `V_r`; the operation is rejected unless `V_r < V_t` (i.e., the operation's snapshot predates the tombstone) *and* the operation re-validates at commit.
- **C3 (propagation quiescence):** `forget` returns `committed` only when the reaper has confirmed purge across all derived stores *and* the tombstone's `V_t` has been observed by every active writer in the scope (a barrier, not a broadcast).
TTL expiry is valid *only* as a retention-class boundary for scopes with no erasure obligation. It is never a substitute for C1–C3, because expiry is evaluated by the reader, not enforced at the writer, and it carries no version to dominate a concurrent write.
Decision Boundary
The instance must halt — return a hard error, not a degraded result — at exactly one boundary: **when a read warrant and a write warrant for the same lineage are not jointly dominated by the current tombstone version.** Concretely:
- If `read` returns entries under scope `X` at version `V_r`, and before the corresponding `write` the tombstone version for `X` advances to `V_t > V_r`, the `write` MUST fail closed. It must not "retry with fresh data" silently, because the fresh data may itself be a resurrection.
- If `forget` is issued while any writer holds an uncommitted read warrant in the lineage, `forget` must either (a) block until quiescence or (b) return `accepted` with an explicit `pending_writers` set, and the caller MUST NOT treat `accepted` as erasure-complete. Reporting `purged` before `pending_writers` is empty is the exact defect observed.
- If a derived key cannot resolve its parent (C1 broken), the write must be rejected as `lineage_unresolvable`, not admitted optimistically.
The boundary is deliberately narrow: it does not halt on TTL expiry, does not halt on stale reads within a live scope, and does not halt on derived writes whose parent chain is intact and dominated. Halting anywhere broader converts a correctness guard into an availability outage.
Operational Effect
After the fix, the distillation worker's `write` failed closed with `tombstone_domination_violation`; the worker's snapshot was discarded and the derived summary was never created. The erasure completed in 40 minutes with a `pending_writers` set that drained to empty before `committed` was reported. The cost is a measurable increase in write rejections during erasure windows (observed ~3% of derived writes in a busy scope), which is the correct trade: a rejected derived write is recoverable, a resurrected subject record is a compliance incident.
The general lesson for any agent holding a memory tool API: **treat `forget` as a version fence, not a queue message, and treat `accepted` as a promise about the tombstone, never about the data.** The tombstone must dominate every read and write in its lineage, or the instance must stop.
from dataclasses import dataclass
class TombstoneDominationError(RuntimeError):
"""Raised when a write/read in an erasure lineage is not dominated by the tombstone."""
@dataclass(frozen=True)
class Warrant:
scope: str
version: int
parent_chain: tuple[str, ...]
def commit_write(warrant: Warrant, tombstone_version: dict[str, int], lineage_root: str) -> None:
# C1: lineage must resolve to the erased root
if lineage_root not in warrant.parent_chain and warrant.scope != lineage_root:
raise TombstoneDominationError(
f"lineage_unresolvable: scope={warrant.scope!r} does not chain to {lineage_root!r}"
)
# C2: tombstone must dominate the warrant's snapshot version
vt = tombstone_version.get(lineage_root)
if vt is not None and warrant.version >= vt:
raise TombstoneDominationError(
f"tombstone_domination_violation: warrant.version={warrant.version} "
f">= tombstone.version={vt} for root={lineage_root!r}; write must fail closed"
)
def finalize_forget(pending_writers: set[str], purge_confirmed: bool) -> str:
# C3: erasure is committed only at quiescence
if not purge_confirmed or pending_writers:
return f"accepted:pending_writers={sorted(pending_writers)}"
return "committed"