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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(onboarding): restart the app fresh when onboarding completes
Ruben Lütke0fd1a185bc63
diff --git a/jarvis/ui/web/onboarding_routes.py b/jarvis/ui/web/onboarding_routes.pyindex 7149b92111..59bf50b336 100644--- a/jarvis/ui/web/onboarding_routes.py+++ b/jarvis/ui/web/onboarding_routes.py@@ -112,10 +112,37 @@ async def post_ack_wake_word() -> dict:return {"ok": True}+def _schedule_fresh_restart(request: Request) -> bool:+ """Restart the app in a fresh process right after onboarding completes.++ The first launch happens straight out of the installer: the process the+ user just walked through onboarding has been running since BEFORE the+ language, wake word, and providers were configured. A relauncher restart+ (``DesktopApp.request_restart()`` — the same detached helper the+ self-update uses) re-initializes every subsystem from the now-complete+ config, so the assistant never lingers half-warm. The completion marker+ is persisted before this is called, so the fresh instance reads+ completed=true and can never re-open the gate. Headless hosts have no+ window — ``request_restart`` reports False and onboarding simply+ completes in place. Best-effort: a restart failure never fails the+ completion request.+ """+ desktop = getattr(request.app.state, "desktop_app", None)+ fn = getattr(desktop, "request_restart", None)+ if not callable(fn):+ return False+ try:+ return bool(fn())+ except Exception: # noqa: BLE001 — completing onboarding must never 500 here+ log.warning("post-onboarding fresh restart failed; staying up", exc_info=True)+ return False++@router.post("/complete")-async def post_complete() -> dict:+async def post_complete(request: Request) -> dict:st.mark_onboarding_complete(_path())- return {"ok": True}+ restarting = _schedule_fresh_restart(request)+ return {"ok": True, "restarting": restarting}__all__ = ["router"]diff --git a/tests/unit/ui/test_onboarding_routes.py b/tests/unit/ui/test_onboarding_routes.pyindex 20f5ca224d..de720d4f82 100644--- a/tests/unit/ui/test_onboarding_routes.py+++ b/tests/unit/ui/test_onboarding_routes.py@@ -153,3 +153,67 @@ def test_schedule_shutdown_headless_falls_back_to_hard_exit(monkeypatch):req = SimpleNamespace(app=SimpleNamespace(state=SimpleNamespace()))onboarding_routes._schedule_app_shutdown(req)assert len(started) == 1 # armed exactly one delayed exit, nothing immediate+++# ---------------------------------------------------------------- complete → fresh restart+# Maintainer request 2026-07-15: the first launch happens straight out of the+# installer, so the process that hosted onboarding predates every configured+# provider (language, wake word, API keys). Completing onboarding therefore+# restarts the app fresh via the relauncher; hosts without a window (headless)+# simply complete in place, and a restart failure never fails the request.+++def _client_with_desktop(desktop):+ app = FastAPI()+ app.include_router(onboarding_routes.router)+ app.state.desktop_app = desktop+ return TestClient(app)+++def test_complete_restarts_fresh_on_desktop(state_dir):+ from types import SimpleNamespace++ completed_when_restart_fired: list[bool] = []++ def restart() -> bool:+ # The completion marker must already be persisted when the restart+ # fires, so the fresh instance can never re-open the gate.+ completed_when_restart_fired.append(+ onboarding_routes._safe_state_payload()["completed"]+ )+ return True++ c = _client_with_desktop(SimpleNamespace(request_restart=restart))+ r = c.post("/api/onboarding/complete")+ assert r.status_code == 200+ assert r.json() == {"ok": True, "restarting": True}+ assert completed_when_restart_fired == [True]+++def test_complete_without_desktop_completes_in_place(client):+ r = client.post("/api/onboarding/complete")+ assert r.status_code == 200+ assert r.json() == {"ok": True, "restarting": False}+ assert client.get("/api/onboarding/state").json()["completed"] is True+++def test_complete_when_restart_reports_no_window(state_dir):+ from types import SimpleNamespace++ c = _client_with_desktop(SimpleNamespace(request_restart=lambda: False))+ r = c.post("/api/onboarding/complete")+ assert r.json() == {"ok": True, "restarting": False}+ assert c.get("/api/onboarding/state").json()["completed"] is True+++def test_complete_survives_restart_failure(state_dir):+ from types import SimpleNamespace++ def boom() -> bool:+ raise RuntimeError("relauncher spawn failed")++ c = _client_with_desktop(SimpleNamespace(request_restart=boom))+ r = c.post("/api/onboarding/complete")+ assert r.status_code == 200+ assert r.json() == {"ok": True, "restarting": False}+ assert c.get("/api/onboarding/state").json()["completed"] is True