Skip to content

ADR-0019 — Expiry by inactivity on the database clock

  • Status: Accepted
  • Date: 2026-11-13
  • Supersedes: none
  • Authors: project maintainers

Context

Applications want old threads removed without tracking them. Checkpoint ids are client-side uuid6 values, and copy_thread keeps them, so a fresh copy would look old by its ids. An expiry rule needs a clock every write updates.

Decision

A thread will expire by inactivity on the database clock. asweep_expired(idle_for=…) deletes whole threads idle longer than idle_for, re-checking each before it deletes it. There is no per-thread expires_at until a caller needs one.

Alternatives considered

  • An explicit expires_at per thread with a setter — rejected for now: no caller needs per-thread retention, and a column nobody writes is dead weight.
  • Both, expires_at overriding inactivity — rejected: both costs; add it when a caller asks.

Consequences

  • One retention period per sweep call; no per-thread or per-tenant policy.
  • Every root put refreshes the clock, so expiry always has a writer.
  • The application calls the sweeper; the saver runs no background task.

References