Infinite loading guard: heartbeats + stall watchdogs on the model runs

A user got stuck on the wizard's loading screen: a hung model meant
silence, and silence was indistinguishable from work - the server's own
hard deadline is 2x OLLAMA_TIMEOUT_MS (ten minutes by default), and the
client waited on a dead stream indefinitely.

Both generate routes (deck, homework) now send an NDJSON heartbeat
every 15s, and the client guards the two quiet phases: no response at
all for 45s, and no bytes for 90s mid-stream, both surfacing the
regular error state with a Retry. The caller's abort still maps to the
friendly "cancelled" state.

Verified with a stalled route and Playwright's fake clock in the wizard
suite (93 checks), plus contrast 0 findings, mobile 124/124, chat
101/101, regression 44/44, i18n 13/13, native 33/33.
Version 0.4.0, SW -> freezmo-v69.
This commit is contained in:
Martin Dvořák 2026-10-13 18:06:25 +00:00
commit 20bb08b0e7
8 changed files with 125 additions and 19 deletions

View file

@ -720,6 +720,7 @@ const en: Record<string, string> = {
"api.unreachableShort": "Could not reach the Freezmo server.",
"api.httpError": "The server returned HTTP {status}.",
"api.empty": "The server sent an empty response.",
"api.stalled": "The model stopped responding. Check it and try again.",
"api.almost": "Almost there…",
"api.noDeck": "No deck came back from the server. Check your Ollama settings and try again.",
"api.incomplete": "The server finished without sending a deck.",
@ -1675,6 +1676,7 @@ const cs: Record<string, string> = {
"api.unreachableShort": "Nepodařilo se připojit k serveru Freezmo.",
"api.httpError": "Server vrátil HTTP {status}.",
"api.empty": "Server poslal prázdnou odpověď.",
"api.stalled": "Model přestal odpovídat. Zkontrolujte ho a zkuste to znovu.",
"api.almost": "Už to bude…",
"api.noDeck": "Ze serveru nepřišla žádná sada. Zkontroluj nastavení Ollamy a zkus to znovu.",
"api.incomplete": "Server skončil, aniž by poslal sadu.",