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

+6
View File
@@ -210,6 +210,12 @@ void Server::register_routes() {
[this](const HttpRequest& q) { return handle_control_vector(q); });
router_.post("/admin/control-vector",
[this](const HttpRequest& q) { return handle_control_vector(q); });
/* Forget one stored conversation: by its client label in the path (or `?label=`, for a
* label the path cannot carry), or by engine id with `?id=`. */
router_.add ("DELETE", "/sessions/:label",
[this](const HttpRequest& q) { return handle_session_release(q); });
router_.add ("DELETE", "/sessions",
[this](const HttpRequest& q) { return handle_session_release(q); });
}
/* Workers beyond the admission ceiling. A generation holds its connection's worker for its whole