Repository navigation
Description
What
retriever.retention_days (default 30) and max_entries (default 200) are enforced by evict(), and evict() is called from exactly one place: store_inner, immediately after inserting a new row (src/core/retriever.rs, the insert recall row path).
So retention is a property of continued use, not of elapsed time. A machine where rtk stops eliding — a project finished, a laptop set aside, a filter disabled, a contractor's box left on a shelf — keeps every stored row indefinitely, while rtk config recall and the documented default both say 30 days.
Nothing is wrong with the eviction logic itself; it is correct on an active machine. The gap is the claim.
Why it is worth a fix rather than a doc note
The stored rows are the output a filter hid, plus the command text, cwd and exit code. On a machine where that output is sensitive, "we keep it 30 days" is exactly the sentence a reviewer relies on, and it holds only while somebody keeps working. A stated retention that silently doesn't apply is the same shape as the two defects already fixed this week — #4141 (init exits 0 having installed nothing) and #4143 (discover reports "looks good" over zero sessions scanned): the tool reports a state it did not reach.
Possible fixes, in increasing cost
- Evict on read too — call
evict()from therecallcommand path, and fromgain/config recall. Cheap, and it makes "did anyone look at this machine" the trigger rather than "did anyone store on it". - Evict on open — a sweep in
open()behind a cheap guard (e.g. at most once per process, or when the newest row is older than the retention window). Bounds the staleness by "rtk ran at all". - Document it honestly — change the wording to "entries are evicted when rtk next stores output", and say so in
rtk config recall. Correct, cheapest, and worse than either of the above for anyone reasoning about data lifetime.
I would take (2) with (1) as the fallback, but this is your design call. Happy to send a PR for whichever you prefer.
Context
Found while documenting rtk's local stores for a two-machine deployment, after checking what rtk recall persists and where. The store itself is well-behaved: content-addressed, compressed, size-capped, and 0700/0600 on Unix. Worth noting separately that set_owner_only is #[cfg(not(unix))] {}, so on Windows the files carry whatever the profile ACL grants — I can raise that as its own issue if it isn't already known.
Activity
rtk-wshm-sync-bot commentedon Sep 20, 2026
🔍 Automated Triage
bugmediumSummary
Recall retention (retention_days/max_entries) is only enforced on write via evict() in store_inner, so an idle machine retains rows past the documented 30-day window; add eviction on read/open paths too.
📁 Relevant files
src/core/retriever.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
dopaemon commentedon Sep 20, 2026
Can I take on this issue ?
dopaemon commentedon Sep 20, 2026
Fixed in #4145, taking option (2) — which covers (1) as a side effect.
Rather than calling
evict()from each command path, the sweep now runs from the two connection entry points (open,open_existing), so anything that touches the store —rtk recall,gain,config recall, the tee stats path — enforcesretention_days. Staleness is bounded by "rtk ran at all" instead of "rtk stored something", and there's one sweep site rather than one per caller to keep in sync.It keeps the properties that made the current code well-behaved: best-effort like
evict(a read-only or locked store keeps its rows), and the read path still never creates the database, sinceopen_existingreturns early when the file is absent.Reproduced the gap on
developfirst with an isolated store and a row aged 31 days:rtk recall --listlisted it and left it in place. With the fix that same read-only listing drops it and keeps the fresh row.On the Windows note —
set_owner_onlybeing#[cfg(not(unix))] {}is a real and separate concern; I left it out of this PR, so please do raise it as its own issue.