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(ui): a blank window heals itself, and says why when it cannot

Harald86a604af77df
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 466b985508..1fa1f5ff4b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,17 @@ versioning per [SemVer](https://semver.org/).
### Fixed
+- **A question about your own machine gets an answer, not a refusal.**
+ Asking whether the PC is overheating or overloaded matched none of the
+ planner's question rules — such a sentence carries no question word and
+ no possessive — so the turn was never allowed to read the machine, and
+ the execute guard judged the model's shell call by the worst command
+ that tool could ever carry. Jarvis answered "I can't run actions right
+ now", twice in a row. The planner now knows the machine's own
+ vocabulary and the indirect question that hides a lookup inside a
+ statement, a call whose arguments only read passes the guard, and a
+ turn whose every call was gated says what actually happened instead of
+ claiming the assistant is broken.
- **Dictation translation reads like the target language now.** The
translate pass ran on the same tiny model the formatter uses, which
punctuates well and translates flatly — measured on real German
@@ -52,6 +63,17 @@ versioning per [SemVer](https://semver.org/).
short "I'll play that" ack it used to look ready even though YouTube
Music was still running. Progress speech now returns to thinking until
the result is spoken.
+- **A window that shows nothing now says why, and heals itself.** Rebuilding
+ the frontend while the desktop window is open could leave it empty — the
+ ground colour and nothing else, until the app was killed. The single
+ automatic reload the app spends on a missing chunk hands the failure to a
+ view's error card, and a failure above that has no card to land in; the
+ bundle watch that would have picked up the fresh build lives in the bundle
+ that is not running. `index.html` now carries a watchdog that runs whatever
+ the bundle does: an emptied page reloads once within seconds, a splash that
+ never becomes an app after twenty, and a second failure paints what went
+ wrong plus a Reload button instead of staying dark. The guard is released as
+ soon as the app is up, so a later rebuild in the same session still heals.
- **The deck opens on the board, and the waiting screen is gone.** Starting
the app left you on a standby ring under a big "Say 'Hey Nova'", with
nothing to look at until you spoke. That screen has been cut. The start is
diff --git a/jarvis/ui/web/frontend/index.html b/jarvis/ui/web/frontend/index.html
index ea07c5b89c..c9f699ac86 100644
--- a/jarvis/ui/web/frontend/index.html
+++ b/jarvis/ui/web/frontend/index.html
@@ -149,6 +149,167 @@
});
})();
</script>
+ <script>
+ // The last line of defence against a window that shows NOTHING.
+ //
+ // Seen on 2026-08-20: a rebuild while the desktop window was open left
+ // the app mounted but with an empty #root — no error card, no splash,
+ // just the ground colour. src/lib/preloadRecovery.ts spends exactly one
+ // reload on a missing lazy chunk and then hands the failure to a view's
+ // error boundary; a failure ABOVE that boundary has no card to land in,
+ // and src/lib/bundleWatch.ts cannot help either — it lives in the bundle
+ // that is not running. So this watchdog lives in the HTML, where it runs
+ // whatever the bundle does.
+ //
+ // Two clocks, because the two failures look different: an #root emptied
+ // by a crash is a fact within a frame, while a splash that is still
+ // spinning may just be a large bundle on a cold cache. One automatic
+ // reload per incident, released again as soon as the app is up, so a
+ // later rebuild in the same session still heals itself. When the reload
+ // has been spent, the window says what happened instead of staying dark
+ // — a screen with no explanation is the bug, not the crash behind it.
+ (function () {
+ var CRASH_GRACE_MS = 2500;
+ var LOAD_GRACE_MS = 20000;
+ var POLL_MS = 500;
+ var KEY = "jarvis:blank-reloaded";
+ var started = Date.now();
+ var lastError = "";
+
+ window.addEventListener(
+ "error",
+ function (e) {
+ lastError = (e && (e.message || (e.error && e.error.message))) || lastError;
+ },
+ true,
+ );
+ window.addEventListener("unhandledrejection", function (e) {
+ var r = e && e.reason;
+ lastError = (r && (r.message || String(r))) || lastError;
+ });
+
+ function state() {
+ var root = document.getElementById("root");
+ if (!root || root.childElementCount === 0) return "empty";
+ if (
+ root.childElementCount === 1 &&
+ root.firstElementChild &&
+ root.firstElementChild.id === "jarvis-boot-splash"
+ ) {
+ return "splash";
+ }
+ return "up";
+ }
+
+ function texts() {
+ var lang = (navigator.language || "en").slice(0, 2);
+ if (lang === "de") {
+ return {
+ title: "Die Oberfläche wurde nicht geladen.", // i18n-allow
+ why: "Grund: ", // i18n-allow
+ unknown: "Kein Grund gemeldet.", // i18n-allow
+ hint: "Das passiert, wenn die Oberfläche neu gebaut wird, während das Fenster offen ist.", // i18n-allow
+ button: "Neu laden", // i18n-allow
+ };
+ }
+ if (lang === "es") {
+ return {
+ title: "La interfaz no se cargó.", // i18n-allow
+ why: "Motivo: ", // i18n-allow
+ unknown: "No se informó ningún motivo.", // i18n-allow
+ hint: "Ocurre cuando la interfaz se reconstruye con la ventana abierta.", // i18n-allow
+ button: "Recargar", // i18n-allow
+ };
+ }
+ return {
+ title: "The interface did not load.",
+ why: "Reason: ",
+ unknown: "No reason was reported.",
+ hint: "This happens when the interface is rebuilt while the window is open.",
+ button: "Reload",
+ };
+ }
+
+ function report() {
+ var root = document.getElementById("root");
+ if (!root) return;
+ var t = texts();
+ root.innerHTML = "";
+ var box = document.createElement("div");
+ box.id = "jarvis-boot-splash";
+ var h = document.createElement("div");
+ h.className = "name";
+ h.textContent = t.title;
+ var why = document.createElement("div");
+ why.className = "sub";
+ why.style.textTransform = "none";
+ why.style.maxWidth = "60ch";
+ why.style.textAlign = "center";
+ why.textContent = lastError ? t.why + lastError : t.unknown;
+ var hint = document.createElement("div");
+ hint.className = "sub";
+ hint.style.textTransform = "none";
+ hint.style.maxWidth = "60ch";
+ hint.style.textAlign = "center";
+ hint.textContent = t.hint;
+ var btn = document.createElement("button");
+ btn.type = "button";
+ btn.textContent = t.button;
+ btn.style.cssText =
+ "margin-top:6px;padding:7px 16px;font:inherit;font-size:13px;cursor:pointer;" +
+ "color:var(--jbs-accent);background:transparent;border:1px solid var(--jbs-ring);border-radius:4px";
+ btn.onclick = function () {
+ try {
+ sessionStorage.removeItem(KEY);
+ } catch (e) {
+ /* storage blocked — the reload still happens */
+ }
+ location.reload();
+ };
+ box.appendChild(h);
+ box.appendChild(why);
+ box.appendChild(hint);
+ box.appendChild(btn);
+ root.appendChild(box);
+ }
+
+ var timer = setInterval(function () {
+ var now = state();
+ if (now === "up") {
+ clearInterval(timer);
+ // The page is healthy: give the next incident its own reload.
+ try {
+ sessionStorage.removeItem(KEY);
+ } catch (e) {
+ /* storage blocked — nothing to release */
+ }
+ return;
+ }
+ var waited = Date.now() - started;
+ if (waited < (now === "empty" ? CRASH_GRACE_MS : LOAD_GRACE_MS)) return;
+ clearInterval(timer);
+ var spent = null;
+ try {
+ spent = sessionStorage.getItem(KEY);
+ } catch (e) {
+ // A storage that cannot be read cannot bound a reload loop, so no
+ // reload is started: the window explains itself instead.
+ spent = "1";
+ }
+ if (!spent) {
+ try {
+ sessionStorage.setItem(KEY, "1");
+ } catch (e) {
+ report();
+ return;
+ }
+ location.reload();
+ return;
+ }
+ report();
+ }, POLL_MS);
+ })();
+ </script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
diff --git a/jarvis/ui/web/frontend/src/lib/bootWatchdog.test.ts b/jarvis/ui/web/frontend/src/lib/bootWatchdog.test.ts
new file mode 100644
index 0000000000..d46221a450
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/bootWatchdog.test.ts
@@ -0,0 +1,142 @@
+import { existsSync, readFileSync } from "node:fs";
+import { dirname, resolve } from "node:path";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+
+/**
+ * The watchdog that lives in `index.html`, not in this bundle.
+ *
+ * It is the only thing standing between a crash above every error boundary
+ * and a window that shows nothing at all (seen 2026-08-20: a rebuild while
+ * the desktop window was open left `#root` empty and the app dark until it
+ * was killed). Because it has to survive a bundle that never runs, it cannot
+ * be a module — so the test pulls the script out of the HTML and runs it, and
+ * a change that breaks it fails here rather than on somebody's screen.
+ */
+
+/** The Vite entry document, found from wherever the runner was started. */
+function indexHtmlPath(): string {
+ let dir = process.cwd();
+ for (;;) {
+ const candidate = resolve(dir, "index.html");
+ if (existsSync(candidate)) return candidate;
+ const up = dirname(dir);
+ if (up === dir) throw new Error("index.html not found above " + process.cwd());
+ dir = up;
+ }
+}
+
+const HTML = readFileSync(indexHtmlPath(), "utf8");
+
+/** The one inline script that owns the reload guard. */
+function watchdogSource(): string {
+ const scripts = HTML.match(/<script>([\s\S]*?)<\/script>/g) ?? [];
+ const found = scripts.find((s) => s.includes("jarvis:blank-reloaded"));
+ if (!found) throw new Error("index.html no longer carries the blank-window watchdog");
+ return found.replace(/^<script>/, "").replace(/<\/script>$/, "");
+}
+
+interface Run {
+ reloads: () => number;
+ store: Map<string, string>;
+}
+
+/**
+ * Run the watchdog against this document, with `location` and `sessionStorage`
+ * shadowed by test doubles (jsdom's own `location.reload` cannot be spied on).
+ */
+function runWatchdog(): Run {
+ let reloads = 0;
+ const store = new Map<string, string>();
+ const sessionStorageStub = {
+ getItem: (k: string) => store.get(k) ?? null,
+ setItem: (k: string, v: string) => void store.set(k, v),
+ removeItem: (k: string) => void store.delete(k),
+ };
+ const locationStub = { reload: () => void (reloads += 1) };
+ // eslint-disable-next-line no-new-func
+ new Function("sessionStorage", "location", watchdogSource())(
+ sessionStorageStub,
+ locationStub,
+ );
+ return { reloads: () => reloads, store };
+}
+
+function setRoot(inner: string) {
+ document.body.innerHTML = `<div id="root">${inner}</div>`;
+}
+
+const SPLASH = '<div id="jarvis-boot-splash"><div class="ring"></div></div>';
+
+describe("the blank-window watchdog in index.html", () => {
+ beforeEach(() => {
+ vi.useFakeTimers();
+ });
+ afterEach(() => {
+ vi.useRealTimers();
+ document.body.innerHTML = "";
+ });
+
+ test("an app that mounts is left alone — and releases the guard for later", () => {
+ setRoot(SPLASH);
+ const run = runWatchdog();
+ run.store.set("jarvis:blank-reloaded", "1");
+ setRoot("<main>the deck</main>");
+ vi.advanceTimersByTime(1_000);
+ expect(run.reloads()).toBe(0);
+ // A rebuild later in the same session gets its own reload again.
+ expect(run.store.has("jarvis:blank-reloaded")).toBe(false);
+ });
+
+ test("a splash still spinning gets the long grace, then one reload", () => {
+ setRoot(SPLASH);
+ const run = runWatchdog();
+ vi.advanceTimersByTime(10_000);
+ expect(run.reloads()).toBe(0);
+ vi.advanceTimersByTime(11_000);
+ expect(run.reloads()).toBe(1);
+ });
+
+ test("an emptied root is a crash, and does not wait twenty seconds for it", () => {
+ setRoot("");
+ const run = runWatchdog();
+ vi.advanceTimersByTime(3_000);
+ expect(run.reloads()).toBe(1);
+ expect(run.store.get("jarvis:blank-reloaded")).toBe("1");
+ });
+
+ test("the second failure says what happened instead of reloading again", () => {
+ setRoot("");
+ const run = runWatchdog();
+ run.store.set("jarvis:blank-reloaded", "1");
+ vi.advanceTimersByTime(3_000);
+ expect(run.reloads()).toBe(0);
+ const root = document.getElementById("root")!;
+ expect(root.textContent).toContain("The interface did not load.");
+ expect(root.textContent).toContain("No reason was reported.");
+ expect(root.querySelector("button")?.textContent).toBe("Reload");
+ });
+
+ test("it names the error it caught, so the window is never a mystery", () => {
+ setRoot("");
+ const run = runWatchdog();
+ run.store.set("jarvis:blank-reloaded", "1");
+ window.dispatchEvent(
+ new ErrorEvent("error", { message: "Failed to fetch dynamically imported module" }),
+ );
+ vi.advanceTimersByTime(3_000);
+ expect(run.reloads()).toBe(0);
+ expect(document.getElementById("root")!.textContent).toContain(
+ "Failed to fetch dynamically imported module",
+ );
+ });
+
+ test("the reload button clears the guard, so the fresh page may heal itself", () => {
+ setRoot("");
+ const run = runWatchdog();
+ run.store.set("jarvis:blank-reloaded", "1");
+ vi.advanceTimersByTime(3_000);
+ document.getElementById("root")!.querySelector("button")!.click();
+ expect(run.reloads()).toBe(1);
+ expect(run.store.has("jarvis:blank-reloaded")).toBe(false);
+ });
+});