server: DELETE /sessions forgets one stored conversation

A client that deleted a conversation, or compacted it past a prefix, knows the
rest is dead before --prefix-cache-ttl does. DELETE /sessions/<label> (or
?label=, ?id=<engine id>) walks the session's chain from the tip inwards like
expiry: VRAM blocks to the pool, the host copy with them, the session's
snapshots to the store. ?keep_tokens=N keeps the chain's start in whole blocks.
Blocks another stored session shares (the system prompt) and blocks a live
request reads stay and are counted apart; the row is cut at the deepest block
that stayed, so a later release reaches it. A request of the same conversation
in flight is 409. IScheduler::release_session beside reset_prefix_cache,
PrefixCache::release_session over the tiers' session table (find_sessions,
shared_prefix_blocks, cut_session). Counters released{entries,snapshots} on
/sessions and /stats, prefix_cache_released_total{what} on /metrics.
This commit is contained in:
Nunze committed 2026-10-22 09:58:08 +00:00
1 parent 123c439684
commit 3aded1bbf8
20 files changed
+722 -2

No files matched your search

+9
View File
@@ -190,6 +190,8 @@ void Metrics::sample(const SchedMetrics& m) {
c_prefix_ckpt_evict_.advance_to(m.prefix_ckpt_evictions);
c_prefix_expired_.advance_to(m.prefix_expired);
c_prefix_ckpt_expired_.advance_to(m.prefix_ckpt_expired);
c_prefix_released_.advance_to(m.prefix_released);
c_prefix_ckpt_released_.advance_to(m.prefix_ckpt_released);
c_ckpt_retired_.advance_to(m.prefix_ckpt_retired);
c_ckpt_lru_.advance_to(m.prefix_ckpt_lru);
c_ckpt_refused_.advance_to(m.prefix_ckpt_refused);
@@ -447,6 +449,13 @@ std::string Metrics::render() const {
c_ckpt_retired_.get());
labelled("radiance:prefix_cache_ckpt_evictions_by_reason_total", "reason", "store_full",
c_ckpt_lru_.get());
w.help("radiance:prefix_cache_released_total",
"Prefix-cache entries and linear-state snapshots a client released on purpose "
"(DELETE /sessions).", "counter");
labelled("radiance:prefix_cache_released_total", "what", "entries",
c_prefix_released_.get());
labelled("radiance:prefix_cache_released_total", "what", "snapshots",
c_prefix_ckpt_released_.get());
w.counter("radiance:prefix_cache_ckpt_refused_total",
"Checkpoints not written because every snapshot slot was in use by a restore "
"in the same step.", L, c_ckpt_refused_.get());