From 10f0844bf9150834648b73ffc2aae26b228ce77e Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Mon, 31 Aug 2026 08:25:03 +0200 Subject: [PATCH] Coach-Warmup: die Review zuletzt waermen, ihr gehoert der einzige Slot Mit OLLAMA_NUM_PARALLEL=1 gibt es einen Live-Slot, und er gehoert dem letzten Prompt; die Wiederherstellung grosser Prompts aus dem Cache ist nicht verlaesslich. Der Warmup endete mit dem Debrief-Prefix und klaute der Review den Slot: Review nach Debrief-Ping 402 s, nach Review-Ping 26 s. Also: debrief zuerst, review zuletzt. --- api/coach/warmup.js | 8 ++++++-- api/test/warmup.test.js | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/coach/warmup.js b/api/coach/warmup.js index 3ca9e3c..dcbd1f0 100644 --- a/api/coach/warmup.js +++ b/api/coach/warmup.js @@ -17,8 +17,12 @@ import { fetchFor } from './node-fetch.js'; const INTERVAL_MS = 30 * 60000; const TIMEOUT_MS = 10 * 60000; -// The two kinds a chat actually runs day to day; `create` happens once per user and may pay cold. -const KINDS = ['review', 'debrief']; +// The two kinds a chat runs day to day; `create` happens once per user and may pay cold. +// Review is deliberately LAST: with OLLAMA_NUM_PARALLEL=1 there is one live slot, it belongs +// to whatever ran most recently, and the fallback restore from the prompt cache is not +// reliable for large prompts — so the slot must end up holding the kind people actually use. +// (Measured: a review right after a debrief ping took 402 s; right after a review ping, 26 s.) +const KINDS = ['debrief', 'review']; let running = false; diff --git a/api/test/warmup.test.js b/api/test/warmup.test.js index 45e83c4..3115593 100644 --- a/api/test/warmup.test.js +++ b/api/test/warmup.test.js @@ -27,7 +27,8 @@ test('warmup pings the compatible endpoint once per chat kind, with the real rul assert.equal(r.ok, true); assert.equal(seen.length, 2); const reviewPrefix = buildPromptParts('review', {}).system; - assert.ok(seen[0].messages[0].content.endsWith(reviewPrefix), 'system message carries the byte-identical review rules'); + assert.ok(seen[1].messages[0].content.endsWith(reviewPrefix), 'review is warmed LAST, so the single live slot ends up holding it'); + assert.ok(seen[0].messages[0].content.endsWith(buildPromptParts('debrief', {}).system)); assert.equal(seen[0].model, 'm1'); cfgStore.save({ provider: 'anthropic' });