Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Coach-Warmup: die Review zuletzt waermen, ihr gehoert der einzige Slot

Duarte Santos10f0844bf915
diff --git a/api/coach/warmup.js b/api/coach/warmup.js
index 3ca9e3c78..dcbd1f09c 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 45e83c42c..311559331 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' });