fix(backend): check read-only 409 before the Ollama preflight on resume

This commit is contained in:
2026-06-29 20:06:03 +02:00
parent 90a26dafce
commit a791919925
3 changed files with 17 additions and 5 deletions
+11
View File
@@ -152,6 +152,17 @@ test("POST /sessions proceeds when ollamaEnsure succeeds", async () => {
expect(ensureWs).toBe("psd");
});
test("POST /sessions/:id/resume returns 409 for a read-only session without calling ollamaEnsure", async () => {
let ensureCalled = false;
const app = mutApp({
sessionShow: async () => ({ status: "finalized", archived: false }),
ollamaEnsure: async () => { ensureCalled = true; return { ok: false, error: "down" }; },
});
const res = await app.inject({ method: "POST", url: "/sessions/s1/resume" });
expect(res.statusCode).toBe(409);
expect(ensureCalled).toBe(false);
});
test("POST /sessions/:id/resume refuses with 503 when ollamaEnsure fails", async () => {
const app = buildApp(loadConfig({ THT_HARNESS_DIR: "../harness" }), {
thtRunner: {