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
fix: say the UI build is missing instead of Updating forever (#1090)
Ruben Lütkede6202b234f9
diff --git a/dodaios/ui/web/server.py b/dodaios/ui/web/server.pyindex a23c21d6a4..f298b25d23 100644--- a/dodaios/ui/web/server.py+++ b/dodaios/ui/web/server.py@@ -59,7 +59,12 @@ from .schema import (WSWelcome,event_to_ws_envelope,)-from .spa_build import build_is_complete, holding_page_html, recover_conflicted_index+from .spa_build import (+ build_is_complete,+ holding_page_html,+ missing_build_watch,+ recover_conflicted_index,+)from .surface_security import SurfaceSecurity, set_browser_login_requiredif TYPE_CHECKING:@@ -2409,6 +2414,10 @@ class WebServer:if self.cfg.ui.dev_mode:return+ # An install without dist/ would otherwise sit on "Updating…" forever+ # with nothing in the log (issue #1057).+ missing_build_watch.note_startup(INDEX_FILE)+if ASSETS_DIR.is_dir():app.mount("/assets",@@ -2464,6 +2473,7 @@ class WebServer:# holding page below says what is happening and comes back on its own.# See dodaios/ui/web/spa_build.py.if INDEX_FILE.is_file() and build_is_complete(INDEX_FILE, DIST_DIR):+ missing_build_watch.clear()return FileResponse(str(INDEX_FILE),headers={@@ -2473,6 +2483,7 @@ class WebServer:)recovered = recover_conflicted_index(INDEX_FILE, DIST_DIR)if recovered is not None:+ missing_build_watch.clear()return HTMLResponse(content=recovered,headers={@@ -2480,10 +2491,12 @@ class WebServer:"Pragma": "no-cache",},)- return self._spa_placeholder_response()+ return self._spa_placeholder_response(+ build_missing=missing_build_watch.observe(INDEX_FILE)+ )@staticmethod- def _spa_placeholder_response() -> HTMLResponse:+ def _spa_placeholder_response(*, build_missing: bool = False) -> HTMLResponse:"""The boot splash, while dist/ is between two builds.It is deliberately the SAME splash the window opens with — same ground,@@ -2500,7 +2513,7 @@ class WebServer:cure."""return HTMLResponse(- content=holding_page_html(),+ content=holding_page_html(build_missing=build_missing),status_code=200,headers={"Cache-Control": "no-store, max-age=0",diff --git a/dodaios/ui/web/spa_build.py b/dodaios/ui/web/spa_build.pyindex af52eec10e..7408938afc 100644--- a/dodaios/ui/web/spa_build.py+++ b/dodaios/ui/web/spa_build.py@@ -34,6 +34,8 @@ from __future__ import annotationsimport loggingimport re+import threading+import timefrom pathlib import Path__all__ = [@@ -41,6 +43,9 @@ __all__ = ["build_is_complete","recover_conflicted_index","holding_page_html",+ "MissingBuildWatch",+ "MISSING_BUILD_GRACE_S",+ "missing_build_watch","HOLDING_ATTRIBUTE","HOLDING_MARKER",]@@ -173,7 +178,81 @@ def recover_conflicted_index(index_file: Path, dist_dir: Path) -> str | None:return None-def holding_page_html() -> str:+# How long dist/ may stay without a complete build before the holding page+# stops saying "Updating…" and says the build is missing. A real rebuild leaves+# it incomplete for about seven seconds (measured 2026-08-22, see above); a+# slow machine running a cold `npm run build` gets generous headroom on top.+MISSING_BUILD_GRACE_S = 90.0++_log = logging.getLogger(__name__)+++class MissingBuildWatch:+ """Tell a rebuild in flight apart from a UI build that is simply absent.++ The holding page used to say "Updating…" and poll forever when an install+ shipped without ``dist/`` (issue #1057), and nothing in the log said why.+ The server reports every holding-page answer here: once the build has been+ unavailable for longer than :data:`MISSING_BUILD_GRACE_S`, or was already+ missing when the server started, the page says so and one WARNING names+ the path. A complete build resets the watch.+ """++ def __init__(self, grace_s: float = MISSING_BUILD_GRACE_S) -> None:+ self._grace_s = grace_s+ self._lock = threading.Lock()+ self._since: float | None = None+ self._missing_at_startup = False+ self._warned = False++ def note_startup(self, index_file: Path, *, now: float | None = None) -> bool:+ """Record whether the server started without ``index.html``."""+ if index_file.is_file():+ return False+ with self._lock:+ self._missing_at_startup = True+ if self._since is None:+ self._since = time.monotonic() if now is None else now+ self._warn_once(index_file, "at startup")+ return True++ def observe(self, index_file: Path, *, now: float | None = None) -> bool:+ """A holding page is about to be served. Is the build missing for real?"""+ current = time.monotonic() if now is None else now+ with self._lock:+ if self._since is None:+ self._since = current+ missing = self._missing_at_startup or current - self._since >= self._grace_s+ if missing:+ self._warn_once(index_file, f"for more than {int(self._grace_s)} seconds")+ return missing++ def clear(self) -> None:+ """A complete build is on disk again."""+ with self._lock:+ self._since = None+ self._missing_at_startup = False+ self._warned = False++ def _warn_once(self, index_file: Path, when: str) -> None:+ with self._lock:+ if self._warned:+ return+ self._warned = True+ _log.warning(+ "UI build missing %s: no complete frontend build at %s. The window "+ "shows a 'UI build missing' notice until one appears. Reinstall the "+ "app, or run `npm run build` in dodaios/ui/web/frontend in a source "+ "checkout.",+ when,+ index_file,+ )+++missing_build_watch = MissingBuildWatch()+++def holding_page_html(*, build_missing: bool = False) -> str:"""The page a window gets while a rebuild is between two states on disk.It is the boot splash, deliberately: the same ground, the same ring, the@@ -187,7 +266,21 @@ def holding_page_html() -> str:area keeps producing. Instead it asks the server for the entry document andreloads only once the answer is no longer this page — meaning a completebuild is on disk and a reload will land on something that runs.++ ``build_missing`` swaps "Updating…" for a notice that the UI build is not+ installed, with the two ways to get one. The page keeps polling, so a build+ that does land still takes over on its own."""+ if build_missing:+ status = (+ '<div class="sub">UI build missing</div>'+ '<div class="hint">The web interface files (dodaios/ui/web/dist) are '+ "not installed. Reinstall the app, or run <code>npm run build</code> "+ "in dodaios/ui/web/frontend in a source checkout. This page reloads "+ "on its own once the build is there.</div>"+ )+ else:+ status = '<div class="sub">Updating…</div>'return ("<!doctype html>"'<html lang="en" class="dark"><head>'@@ -217,12 +310,16 @@ def holding_page_html() -> str:"color:var(--jbs-name)}""#s .sub{font-size:12px;color:var(--jbs-sub);letter-spacing:0.06em;""text-transform:uppercase}"+ "#s .hint{max-width:440px;padding:0 16px;font-size:13px;line-height:1.5;"+ "text-align:center;color:var(--jbs-name)}"+ "#s .hint code{font-family:ui-monospace,Consolas,monospace;"+ "color:var(--jbs-accent)}""@keyframes sp{to{transform:rotate(360deg)}}""</style></head><body>"f'<div id="s" data-state="{HOLDING_MARKER}">''<div class="ring"></div>''<div class="name"></div>'- '<div class="sub">Updating…</div>'+ f"{status}""</div>""<script>(function(){try{var n=(localStorage.getItem(""'jarvis.assistantName')||'').trim();if(n){"diff --git a/tests/unit/ui/web/test_missing_ui_build_notice.py b/tests/unit/ui/web/test_missing_ui_build_notice.pynew file mode 100644index 0000000000..e736d6c03f--- /dev/null+++ b/tests/unit/ui/web/test_missing_ui_build_notice.py@@ -0,0 +1,135 @@+"""Issue #1057: an install without its UI build must not say "Updating" forever.++The holding page covers the few seconds a rebuild leaves ``dist/`` incomplete.+When the build is simply not installed, the same page used to poll forever and+nothing was logged. Now a build missing at startup, or for longer than the+normal rebuild window, gets one WARNING with the path and a page that says the+UI build is missing and how to get one.+"""++from __future__ import annotations++import logging+from pathlib import Path++import pytest++from dodaios.ui.web import spa_build+from dodaios.ui.web.spa_build import (+ HOLDING_ATTRIBUTE,+ MISSING_BUILD_GRACE_S,+ MissingBuildWatch,+ holding_page_html,+)++[email protected](autouse=True)+def _fresh_global_watch(monkeypatch: pytest.MonkeyPatch) -> MissingBuildWatch:+ watch = MissingBuildWatch()+ monkeypatch.setattr(spa_build, "missing_build_watch", watch)+ from dodaios.ui.web import server as server_mod++ monkeypatch.setattr(server_mod, "missing_build_watch", watch)+ return watch+++def _warnings(caplog: pytest.LogCaptureFixture) -> list[logging.LogRecord]:+ return [+ r for r in caplog.records+ if r.levelno == logging.WARNING and "UI build missing" in r.getMessage()+ ]+++class TestTheWatch:+ def test_a_short_rebuild_stays_quiet(self, tmp_path: Path, caplog) -> None:+ watch = MissingBuildWatch()+ index = tmp_path / "index.html"+ assert watch.observe(index, now=100.0) is False+ assert watch.observe(index, now=100.0 + MISSING_BUILD_GRACE_S - 1) is False+ assert _warnings(caplog) == []++ def test_a_build_missing_beyond_the_window_warns_once(+ self, tmp_path: Path, caplog+ ) -> None:+ watch = MissingBuildWatch()+ index = tmp_path / "dist" / "index.html"+ watch.observe(index, now=0.0)+ assert watch.observe(index, now=MISSING_BUILD_GRACE_S + 1) is True+ assert watch.observe(index, now=MISSING_BUILD_GRACE_S + 50) is True+ warnings = _warnings(caplog)+ assert len(warnings) == 1+ assert str(index) in warnings[0].getMessage()+ assert "npm run build" in warnings[0].getMessage()++ def test_a_build_missing_at_startup_is_reported_at_once(+ self, tmp_path: Path, caplog+ ) -> None:+ watch = MissingBuildWatch()+ index = tmp_path / "index.html"+ assert watch.note_startup(index, now=0.0) is True+ assert watch.observe(index, now=0.5) is True+ assert len(_warnings(caplog)) == 1++ def test_a_present_build_at_startup_is_not_reported(+ self, tmp_path: Path, caplog+ ) -> None:+ index = tmp_path / "index.html"+ index.write_text("<!doctype html>", encoding="utf-8")+ watch = MissingBuildWatch()+ assert watch.note_startup(index) is False+ assert watch.observe(index, now=1.0) is False+ assert _warnings(caplog) == []++ def test_a_complete_build_resets_the_watch(self, tmp_path: Path) -> None:+ watch = MissingBuildWatch()+ index = tmp_path / "index.html"+ watch.note_startup(index, now=0.0)+ watch.clear()+ assert watch.observe(index, now=1_000.0) is False+++class TestThePage:+ def test_the_default_page_still_says_updating(self) -> None:+ page = holding_page_html()+ assert "Updating" in page+ assert "UI build missing" not in page++ def test_the_missing_build_page_is_actionable_and_keeps_polling(self) -> None:+ page = holding_page_html(build_missing=True)+ assert "UI build missing" in page+ assert "Updating" not in page+ assert "Reinstall the app" in page+ assert "npm run build" in page+ # Still the holding page, so a build that lands takes over by itself.+ assert HOLDING_ATTRIBUTE in page+ assert "location.reload()" in page+ assert "Jarvis" not in page+++class TestTheServerRoute:+ @staticmethod+ def _response(monkeypatch: pytest.MonkeyPatch, dist: Path):+ from dodaios.ui.web import server as server_mod++ monkeypatch.setattr(server_mod, "DIST_DIR", dist)+ monkeypatch.setattr(server_mod, "INDEX_FILE", dist / "index.html")+ return server_mod.WebServer._spa_index_response(server_mod.WebServer)++ def test_missing_at_startup_serves_the_missing_build_page(+ self, tmp_path: Path, monkeypatch, caplog, _fresh_global_watch+ ) -> None:+ dist = tmp_path / "dist"+ dist.mkdir()+ _fresh_global_watch.note_startup(dist / "index.html")+ body = self._response(monkeypatch, dist).body+ assert b"UI build missing" in body+ assert len(_warnings(caplog)) == 1++ def test_a_fresh_gap_still_says_updating(+ self, tmp_path: Path, monkeypatch, caplog+ ) -> None:+ dist = tmp_path / "dist"+ dist.mkdir()+ body = self._response(monkeypatch, dist).body+ assert b"Updating" in body+ assert _warnings(caplog) == []