Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

serve: keep retained K/V through the cache capacity gate

Developer6cd29d9850ad
diff --git a/src/program/generate.cpp b/src/program/generate.cpp
index ee915d275..74c477594 100644
--- a/src/program/generate.cpp
+++ b/src/program/generate.cpp
@@ -4006,11 +4006,12 @@ int main(int argc, char** argv) {
estimate = fresh_estimate;
err.clear();
}
- if (!reuse.kv.empty() && !conversations.can_fit(estimate, held)) {
- // Optional growth capacity must not evict useful conversations.
- reuse = {};
- estimate = fresh_estimate;
- }
+ // A park carrying its own retained K/V replaces memory the cache
+ // already held, so capacity is make_room's call - it runs next either
+ // way, and put()'s accounting still bounds the budget. The with-reuse
+ // estimate must stay uncapped: it counts the retained buffers'
+ // capacity and directories, and put() charges that same true size -
+ // a capped figure would under-evict and overfill the budget.
if (!conversations.make_room(estimate, held)) {
std::fprintf(stderr, "strata serve: conversation cache: skip parking (snapshot %zu MiB exceeds available budget)\n",
estimate >> 20);