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
@@ -103,9 +103,10 @@ and the start spawn behind a seam.
The preflight runs **first**, before any session is created or resumed:
- `POST /sessions`: `const r = await tht.ollamaEnsure(settings.workspace, timeout)`. If `!r.ok`
→ `reply.code(503).send({ error: r.error })` and **return** (do NOT call `sessionNew`/`spawnFor`).
- `POST /sessions/:id/resume`: same preflight **before** the existing finalized/archived guard
and `mgr.resume`. On failure → 503, no spawn. (Uses the session's workspace — the current
configured/settings workspace, consistent with how resume resolves the session.)
- `POST /sessions/:id/resume`: the finalized/archived guard runs **first** — a read-only session
is rejected with 409 without touching Ollama. The preflight runs **after** that guard and
**before** `mgr.resume`. On failure → 503, no spawn. (Uses the session's workspace — the
current configured/settings workspace, consistent with how resume resolves the session.)
### Config ([config.ts](../../../backend/src/config.ts))
- `ollamaEnsureTimeoutMs: number` from `OLLAMA_ENSURE_TIMEOUT_MS` (default `60000`); passed to