Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(onboarding): a failed config write must not end first run at step 04

rubenluetke10-beep6309d636b243
diff --git a/docs/BUGS.md b/docs/BUGS.md
index 5b00cd5784..9af67b858f 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -14688,3 +14688,69 @@ dead token reads `expired`; the chain stops at the first failure and carries no
**Related.** AP-23 (assume an arbitrary downloader, never the maintainer) — the
manual fallback was invisible on a box where the CLI happened to be installed
already.
+
+---
+
+## BUG-209: one unhandled config write ended first run at "HTTP 500 on 04 of 05" (HIGH, FIXED 2026-08-29)
+
+**Symptom.** A downloader reported, unprompted: *"i found this its great but idk
+im facing http 500 error on 04 of 05 setup"*. Step 04 of 05 is the wake-word
+step: `visibleSteps()` drops the macOS-only permissions step on Windows and
+Linux, leaving welcome / language / api-keys / **wake-word** / finish, and the
+header counter renders `String(idx + 1).padStart(2, "0")` — literally "04 of
+05". The `visibleSteps` filter ships from v1.6.0 on, which also dates the
+report. The step then showed the raw string "HTTP 500" and stopped. The guide
+covers the whole window and only closes on completion, so the app was
+unreachable from there on.
+
+**Root cause.** `POST /api/settings/wake-word/activation` was the only settings
+route that turned a failed `jarvis.toml` write into a 500:
+
+```python
+except Exception as exc: # noqa: BLE001 — surface a clean 500, never a stack
+ raise HTTPException(status_code=500, detail=f"Could not persist wake activation: {exc}")
+```
+
+Every sibling writer — `put_ui_language`, `put_wake_word`, `put_appearance` —
+catches the same failure, logs it and answers 200 with `persisted: false`.
+Reproduced against a `jarvis.toml` that is not valid UTF-8 (a Notepad edit on
+Windows) and against broken TOML: step 02's language write answered 200
+`persisted: false`, step 04's phrase write answered 200, and the activation call
+answered **500** in both cases — `'utf-8' codec can't decode byte 0xe9` and
+`Unexpected character: '\n' at line 1 col 8`.
+
+Two things turned that into a dead end rather than a warning:
+
+* All three paths through the step call it — saving a word, "continue anyway"
+ after a degraded save, and choosing the Call shortcut. There is no way through
+ the step that avoids the write.
+* `WakeWordStep` never wired up the `skip` prop it is handed, so the step had no
+ Skip control — even though `onboarding.finish.gap_skipped_wake_word` already
+ existed for exactly that case. `useOnboarding.post` throws `HTTP ${status}`,
+ and a Starlette 500 is plain text so `res.json()` fails and the wake routes
+ fall back to the same string: hence the user's verbatim "http 500 error".
+
+**Fix.**
+
+* `set_wake_activation` persists best-effort like every sibling route and
+ reports `persisted` + `message` instead of raising. A live-applied switch
+ still reaches the running pipeline; the response says plainly that it will not
+ survive a restart.
+* `WakeWordStep` reads `persisted` and reports an honest gap on the finish step
+ when the setting could not be written, rather than claiming the choice stuck.
+* Any failed call in the step now renders a Skip control next to the error, so
+ no backend failure can end first run again. The message itself stays — it is
+ the only clue the user has.
+
+**Guard.** `tests/unit/ui/test_wake_word_route.py`
+(`test_activation_reports_a_failed_persist_instead_of_500`,
+`test_activation_reports_persisted_on_success`) and
+`WakeWordStep.test.tsx` (a rejected activation offers the skip; an unpersisted
+activation advances but reports the gap).
+
+**Related.** AP-23 (assume an arbitrary downloader, never the maintainer) — the
+write never fails on a maintainer box, so the one inconsistent error path stayed
+invisible until someone else's config file was unreadable. Note the remaining
+sharp edge this exposed, not fixed here: an unwritable `jarvis.toml` silently
+discards *every* in-app setting, because best-effort persistence is what all
+these routes do. Only the onboarding dead end is closed.
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx
index 91bc1eb484..8991086022 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx
@@ -6,12 +6,15 @@ const localSpeech = vi.hoisted(() => ({
startInstall: vi.fn(),
}));
const saveWakeWord = vi.fn().mockResolvedValue({ ok: true, degraded: false });
-const setWakeActivation = vi.fn().mockResolvedValue({
+const ACTIVATION_OK = {
ok: true,
enabled: true,
applied_live: true,
restart_required: false,
-});
+ persisted: true,
+ message: "",
+};
+const setWakeActivation = vi.fn().mockResolvedValue(ACTIVATION_OK);
vi.mock("@/hooks/useWakeWord", () => ({
useWakeWord: () => ({ saveWakeWord, setWakeActivation }),
useLocalSpeechInstall: (onInstalled?: () => void) => {
@@ -29,6 +32,7 @@ afterEach(() => {
saveWakeWord.mockClear();
saveWakeWord.mockResolvedValue({ ok: true, degraded: false });
setWakeActivation.mockClear();
+ setWakeActivation.mockResolvedValue(ACTIVATION_OK);
localSpeech.startInstall.mockClear();
localSpeech.onInstalled = undefined;
});
@@ -38,22 +42,22 @@ const onb = {
acknowledgeWakeWord: vi.fn().mockResolvedValue(undefined),
} as never;
-function renderStep(goNext = vi.fn(), setSummary = vi.fn()) {
+function renderStep(goNext = vi.fn(), setSummary = vi.fn(), skip = vi.fn(), setGap = vi.fn()) {
render(
<WakeWordStep
onb={onb}
goNext={goNext}
goBack={vi.fn()}
- skip={vi.fn()}
+ skip={skip}
isFirst={false}
isLast={false}
setSummary={setSummary}
- setGap={vi.fn()}
+ setGap={setGap}
gaps={{}}
summaries={{}}
/>,
);
- return { goNext, setSummary };
+ return { goNext, setSummary, skip, setGap };
}
const primary = () => screen.getByTestId("onboarding-primary") as HTMLButtonElement;
@@ -229,3 +233,30 @@ it("mic-check surfaces permission_required and a probe failure honestly", async
expect(screen.getByText("onboarding.wake_word.mic_check.error")).toBeDefined(),
);
});
+
+it("a failed activation offers a way out instead of trapping first run (BUG-209)", async () => {
+ // The guide covers the whole window and this step had no Skip, so one failing
+ // request ended setup for good — the reported "HTTP 500 on 04 of 05".
+ setWakeActivation.mockRejectedValue(new Error("HTTP 500"));
+ const { goNext, skip } = renderStep();
+
+ fireEvent.click(screen.getByTestId("wake-mode-shortcut"));
+ fireEvent.click(primary());
+
+ await screen.findByText("HTTP 500");
+ expect(goNext).not.toHaveBeenCalled();
+
+ fireEvent.click(screen.getByTestId("wake-skip-after-error"));
+ expect(skip).toHaveBeenCalled();
+});
+
+it("an activation that could not be persisted advances but reports the gap", async () => {
+ setWakeActivation.mockResolvedValue({ ...ACTIVATION_OK, persisted: false, message: "boom" });
+ const { goNext, setGap } = renderStep();
+
+ fireEvent.click(screen.getByTestId("wake-mode-shortcut"));
+ fireEvent.click(primary());
+
+ await waitFor(() => expect(goNext).toHaveBeenCalled());
+ expect(setGap).toHaveBeenLastCalledWith("onboarding.wake_word.gap_not_persisted");
+});
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx
index 5384efe06e..e22cb42c02 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
import { Mic } from "lucide-react";
import { Button, Field } from "@/components/agentic/controls";
import { useWakeWord, useLocalSpeechInstall } from "@/hooks/useWakeWord";
+import type { WakeActivationResult } from "@/hooks/useWakeWord";
import { useT } from "@/i18n";
import { deriveAssistantName } from "@/lib/deriveAssistantName";
import type { StepProps } from "../OnboardingFlow";
@@ -40,7 +41,7 @@ type MicCheckState = "idle" | "checking" | "done";
* unfolds its input in place. One microphone check (the old step had two
* buttons wired to the same probe).
*/
-export function WakeWordStep({ onb, goNext, goBack, setSummary, setGap }: StepProps) {
+export function WakeWordStep({ onb, goNext, goBack, skip, setSummary, setGap }: StepProps) {
const t = useT();
const { saveWakeWord, setWakeActivation } = useWakeWord();
const [mode, setMode] = useState<Mode>("wake");
@@ -81,6 +82,29 @@ export function WakeWordStep({ onb, goNext, goBack, setSummary, setGap }: StepPr
else setSummary(trimmed.length >= 2 ? `Hey ${trimmed}` : null);
}, [mode, trimmed, setSummary, t]);
+ /**
+ * The gap this step reports after activating. A live-applied switch that the
+ * config writer could not persist still works right now but is gone after a
+ * restart — the finish step must say so rather than let the user believe the
+ * choice stuck. `fallback` is the gap the calling path would report anyway.
+ */
+ function activationGap(result: WakeActivationResult, fallback: string | null): string | null {
+ if (result.persisted) return fallback;
+ const notPersisted = t("onboarding.wake_word.gap_not_persisted");
+ return fallback ? `${fallback} ${notPersisted}` : notPersisted;
+ }
+
+ /**
+ * Leave the step without activating anything. Only offered once a call has
+ * actually failed: the guide covers the whole window and this step used to
+ * have no way past a backend error, so a single failing request ended first
+ * run for good (BUG-209). Skipping is recorded, and the finish step lists it.
+ */
+ function skipAfterError() {
+ setGap(null);
+ skip();
+ }
+
function setWordReset(next: string) {
// Any edit invalidates a previous degraded verdict — back to the normal CTA.
setWord(next);
@@ -115,8 +139,7 @@ export function WakeWordStep({ onb, goNext, goBack, setSummary, setGap }: StepPr
setDegraded(true);
return;
}
- await setWakeActivation(true);
- setGap(null);
+ setGap(activationGap(await setWakeActivation(true), null));
goNext();
} catch (e) {
setErr((e as Error).message);
@@ -129,10 +152,14 @@ export function WakeWordStep({ onb, goNext, goBack, setSummary, setGap }: StepPr
setBusy(true);
setErr(null);
try {
- await setWakeActivation(true);
+ const result = await setWakeActivation(true);
// The phrase is saved but nothing can hear it yet — the finish step
// must say so before the user expects "Hey X" to work.
- setGap(t("onboarding.wake_word.gap_degraded").replace("{0}", `Hey ${trimmed}`));
+ const degradedGap = t("onboarding.wake_word.gap_degraded").replace(
+ "{0}",
+ `Hey ${trimmed}`,
+ );
+ setGap(activationGap(result, degradedGap));
goNext();
} catch (e) {
setErr((e as Error).message);
@@ -145,8 +172,7 @@ export function WakeWordStep({ onb, goNext, goBack, setSummary, setGap }: StepPr
setBusy(true);
setErr(null);
try {
- await setWakeActivation(false);
- setGap(null);
+ setGap(activationGap(await setWakeActivation(false), null));
goNext();
} catch (e) {
setErr((e as Error).message);
@@ -181,6 +207,23 @@ export function WakeWordStep({ onb, goNext, goBack, setSummary, setGap }: StepPr
return <StatusLine tone="ok">{t("onboarding.wake_word.mic_check.good")}</StatusLine>;
})();
+ // A failed call must never be the end of first run. The raw message stays
+ // (it is the only clue the user has), but it now comes with the way out this
+ // step was missing: skip activation and finish the guide (BUG-209).
+ const errorBlock = err ? (
+ <div className="space-y-2">
+ <StatusLine tone="error">{err}</StatusLine>
+ <div className="flex flex-wrap items-center gap-3">
+ <Button variant="quiet" onClick={skipAfterError} data-testid="wake-skip-after-error">
+ {t("onboarding.nav.skip")}
+ </Button>
+ <p className="text-[13px] text-muted-foreground">
+ {t("onboarding.wake_word.error_skip_hint")}
+ </p>
+ </div>
+ </div>
+ ) : null;
+
return (
<div className="space-y-8">
<StepSection label={t("onboarding.wake_word.mode_label")}>
@@ -207,7 +250,7 @@ export function WakeWordStep({ onb, goNext, goBack, setSummary, setGap }: StepPr
<p className="text-sm leading-relaxed text-muted-foreground">
{t("onboarding.wake_word.shortcut_note")}
</p>
- {err && <StatusLine tone="error">{err}</StatusLine>}
+ {errorBlock}
<StepFooter
onBack={goBack}
primary={{
@@ -298,7 +341,7 @@ export function WakeWordStep({ onb, goNext, goBack, setSummary, setGap }: StepPr
{t("onboarding.wake_word.ack_label")}
</ConsentLine>
- {err && <StatusLine tone="error">{err}</StatusLine>}
+ {errorBlock}
{degraded ? (
// The chosen word has no pretrained model and local Whisper is
diff --git a/jarvis/ui/web/frontend/src/hooks/useWakeWord.ts b/jarvis/ui/web/frontend/src/hooks/useWakeWord.ts
index d560903c35..a857bc6be2 100644
--- a/jarvis/ui/web/frontend/src/hooks/useWakeWord.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useWakeWord.ts
@@ -57,6 +57,13 @@ export interface WakeActivationResult {
enabled: boolean;
applied_live: boolean;
restart_required: boolean;
+ // False when jarvis.toml could not be written (not UTF-8, broken TOML, locked
+ // file). The switch still applies to a running pipeline; it just will not
+ // survive a restart. Reported instead of raising, so a first run can never be
+ // ended by a config the user cannot repair from here (BUG-209).
+ persisted: boolean;
+ // Empty when persisted; otherwise the writer's own reason, in one sentence.
+ message: string;
}
/**
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 50ac16e1c0..287dd5f8e2 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -3023,7 +3023,9 @@
"permission_required": "Erteile unter Berechtigungen zuerst den Mikrofonzugriff, bevor du diesen Test startest.",
"error": "Das Mikrofon konnte gerade nicht geprüft werden."
},
- "gap_degraded": "„{0}“ ist gespeichert, aber noch kann es niemand hören — das Aktivierungswort bleibt aus, bis das lokale Sprachmodell unter Einstellungen → Aktivierungswort installiert ist. Das Anruf-Kürzel funktioniert solange."
+ "gap_degraded": "„{0}“ ist gespeichert, aber noch kann es niemand hören — das Aktivierungswort bleibt aus, bis das lokale Sprachmodell unter Einstellungen → Aktivierungswort installiert ist. Das Anruf-Kürzel funktioniert solange.",
+ "gap_not_persisted": "Die Aktivierung konnte nicht in die Konfigurationsdatei geschrieben werden und ist nach einem Neustart wieder weg — öffne Einstellungen → Aktivierungswort erneut, sobald die Datei wieder beschreibbar ist.",
+ "error_skip_hint": "Du kannst die Aktivierung überspringen und die Einrichtung abschließen — ein Aktivierungswort lässt sich jederzeit in den Einstellungen festlegen."
},
"finish": {
"summary_label": "Deine Einrichtung",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 80def893e4..ba6430d78e 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -3023,7 +3023,9 @@
"permission_required": "Grant Microphone access in Permissions before running this check.",
"error": "Could not check the microphone right now."
},
- "gap_degraded": "\"{0}\" is saved but nothing can hear it yet — the wake word stays off until the local speech model is installed under Settings → Wake word. The Call shortcut works meanwhile."
+ "gap_degraded": "\"{0}\" is saved but nothing can hear it yet — the wake word stays off until the local speech model is installed under Settings → Wake word. The Call shortcut works meanwhile.",
+ "gap_not_persisted": "The activation could not be written to the configuration file, so it will be gone after a restart — reopen Settings → Wake word once the file is writable again.",
+ "error_skip_hint": "You can skip activation and finish setup — a wake word can be set anytime in Settings."
},
"finish": {
"summary_label": "Your setup",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 2cc2cbcf9f..6203e873cd 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -3023,7 +3023,9 @@
"permission_required": "Concede acceso al Micrófono en Permisos antes de ejecutar esta prueba.",
"error": "No se pudo comprobar el micrófono en este momento."
},
- "gap_degraded": "«{0}» está guardada, pero todavía nadie puede oírla — la palabra de activación permanece desactivada hasta que se instale el modelo de voz local en Ajustes → Palabra de activación. Mientras tanto funciona el atajo de Llamada."
+ "gap_degraded": "«{0}» está guardada, pero todavía nadie puede oírla — la palabra de activación permanece desactivada hasta que se instale el modelo de voz local en Ajustes → Palabra de activación. Mientras tanto funciona el atajo de Llamada.",
+ "gap_not_persisted": "La activación no se pudo escribir en el archivo de configuración, así que desaparecerá tras reiniciar — vuelve a abrir Ajustes → Palabra de activación cuando el archivo vuelva a admitir escritura.",
+ "error_skip_hint": "Puedes omitir la activación y terminar la configuración — una palabra de activación se puede definir en cualquier momento en Ajustes."
},
"finish": {
"summary_label": "Tu configuración",
diff --git a/jarvis/ui/web/settings_routes.py b/jarvis/ui/web/settings_routes.py
index 90e7a93cb3..cd110d122e 100644
--- a/jarvis/ui/web/settings_routes.py
+++ b/jarvis/ui/web/settings_routes.py
@@ -1482,14 +1482,26 @@ async def set_wake_activation(body: WakeActivationBody, request: Request) -> dic
pipeline when available. Headless/voice-disabled processes keep the setting
for their next voice start.
"""
+ # Persisting is BEST-EFFORT, exactly like every other settings writer here
+ # (put_ui_language, put_wake_word, put_appearance, ...). This route used to
+ # raise a 500 instead, and that one inconsistency locked first-time users
+ # out of the app: this is the only write onboarding step 04/05 cannot avoid
+ # — all three of its paths (save a word, continue degraded, use the Call
+ # shortcut) call it — the step has no Skip, and the guide covers the whole
+ # window. An unwritable jarvis.toml (not UTF-8, broken TOML, locked file)
+ # therefore ended first run at "HTTP 500" with no way forward (BUG-209).
+ # The failure is REPORTED, never swallowed: `persisted` and `message` carry
+ # it so the UI can say the setting will not survive a restart.
+ persisted = False
+ persist_error = ""
try:
from jarvis.core import config_writer
config_writer.set_wake_word_enabled(bool(body.enabled))
- except Exception as exc: # noqa: BLE001 — surface a clean 500, never a stack
- raise HTTPException(
- status_code=500, detail=f"Could not persist wake activation: {exc}"
- ) from exc
+ persisted = True
+ except Exception as exc: # noqa: BLE001 — best-effort, reported not raised
+ persist_error = str(exc)
+ log.warning("wake activation persist failed: %s", exc)
# Best-effort in-memory update so a later cfg read agrees pre-restart.
cfg = _config(request)
if cfg is not None and getattr(cfg, "trigger", None) is not None:
@@ -1509,7 +1521,15 @@ async def set_wake_activation(body: WakeActivationBody, request: Request) -> dic
"ok": True,
"enabled": bool(body.enabled),
"applied_live": applied_live,
+ # A live-applied switch works right now even when the file write failed;
+ # it just will not survive the next start. Both facts are reported.
"restart_required": not applied_live,
+ "persisted": persisted,
+ "message": (
+ ""
+ if persisted
+ else f"The setting could not be saved to jarvis.toml: {persist_error}"
+ ),
}
diff --git a/tests/unit/ui/test_wake_word_route.py b/tests/unit/ui/test_wake_word_route.py
index 3845c87a04..45f2d8b631 100644
--- a/tests/unit/ui/test_wake_word_route.py
+++ b/tests/unit/ui/test_wake_word_route.py
@@ -255,3 +255,45 @@ def test_put_with_legacy_sensitivity_is_accepted_but_ignored() -> None:
)
assert resp.status_code == 200
assert "sensitivity" not in resp.json()
+
+
+def test_activation_reports_a_failed_persist_instead_of_500(monkeypatch) -> None:
+ """An unwritable jarvis.toml must not end onboarding (BUG-209).
+
+ This route is the one write the wake-word step (04 of 05 on Windows/Linux)
+ cannot avoid — all three of its paths call it — and the step has no Skip.
+ Raising here turned a broken/locked config file into a dead first run at
+ "HTTP 500". Every sibling settings writer reports `persisted: false` and
+ answers 200; this one now does too, and names the reason.
+ """
+ from jarvis.core import config_writer
+
+ def _boom(_enabled: bool) -> None:
+ raise UnicodeDecodeError("utf-8", b"\xe9", 0, 1, "invalid continuation byte")
+
+ monkeypatch.setattr(config_writer, "set_wake_word_enabled", _boom)
+ pipe = _FakePipeline()
+ response = _client(pipeline=pipe).post(
+ "/api/settings/wake-word/activation", json={"enabled": True}
+ )
+
+ assert response.status_code == 200
+ body = response.json()
+ assert body["ok"] is True
+ assert body["persisted"] is False
+ assert "could not be saved" in body["message"]
+ # The switch still reached the running pipeline — it just will not survive
+ # a restart, which is exactly what `persisted` tells the caller.
+ assert pipe.activation is True
+
+
+def test_activation_reports_persisted_on_success(monkeypatch) -> None:
+ from jarvis.core import config_writer
+
+ monkeypatch.setattr(config_writer, "set_wake_word_enabled", lambda _enabled: None)
+ body = _client().post(
+ "/api/settings/wake-word/activation", json={"enabled": True}
+ ).json()
+
+ assert body["persisted"] is True
+ assert body["message"] == ""