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(ui): broken sidebar logo — honest 404 for missing assets + self-healing img
Ruben Lütke5d949e18bd2a
diff --git a/jarvis/ui/web/fast_bootstrap.py b/jarvis/ui/web/fast_bootstrap.pyindex 7b1cf1306d..5043a6c04a 100644--- a/jarvis/ui/web/fast_bootstrap.py+++ b/jarvis/ui/web/fast_bootstrap.py@@ -38,6 +38,35 @@ from .surface_security import SurfaceSecurity# instead of a black screen._DEFAULT_DIST_DIR = Path(__file__).resolve().parent / "dist"+# File extensions the frontend build actually ships. A request for one of+# these that misses on disk must NEVER fall back to the SPA index.html: an+# <img>/<script>/<link> that receives HTML with a 200 renders as permanently+# broken (the browser caches the "success"), which is exactly what happened+# to the sidebar logo during a mid-rebuild dist window. Shared with the real+# app's SPA fallback in server.py.+ASSET_SUFFIXES = frozenset(+ {+ ".css",+ ".gif",+ ".ico",+ ".jpeg",+ ".jpg",+ ".js",+ ".json",+ ".map",+ ".mjs",+ ".png",+ ".svg",+ ".ttf",+ ".txt",+ ".wasm",+ ".webmanifest",+ ".webp",+ ".woff",+ ".woff2",+ }+)+class FastBootstrap:"""Hold-and-delegate ASGI bootstrap server. See module docstring."""@@ -347,6 +376,12 @@ class FastBootstrap:return targetexcept (OSError, ValueError):pass+ # A missing asset file (image/script/font) must not degrade to the+ # SPA index: returning None makes the caller HOLD the request until+ # the real app answers it honestly (file or 404) instead of feeding+ # HTML to an <img> tag. See ASSET_SUFFIXES.+ if Path(rel).suffix.lower() in ASSET_SUFFIXES:+ return Nonereturn index if index.is_file() else None# ---- lifecycle ---------------------------------------------------------diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsxindex 6cffddecf7..166919f0c4 100644--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx@@ -155,6 +155,29 @@ describe("Sidebar header avatar", () => {expect(avatar).not.toBeNull();expect(avatar?.getAttribute("data-variant")).toBe("logo");});++ test("retries a failed logo load with a cache-busted URL (self-healing)", () => {+ // A load that fails once (backend restarting, dist mid-rebuild) must not+ // stick as the browser's broken-image glyph forever: after an error the+ // <img> re-requests the logo under a cache-busting query.+ vi.useFakeTimers();+ try {+ const { container } = renderSidebar();+ const logo = container.querySelector(+ '[data-testid="sidebar-style-avatar"] img',+ ) as HTMLImageElement;+ expect(logo.getAttribute("src")).toBe("/jarvis-logo.png");++ act(() => {+ logo.dispatchEvent(new Event("error"));+ vi.runAllTimers();+ });++ expect(logo.getAttribute("src")).toBe("/jarvis-logo.png?retry=1");+ } finally {+ vi.useRealTimers();+ }+ });});describe("Sidebar brain footer", () => {diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsxindex 4db86d04f4..3d74da8365 100644--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx@@ -28,7 +28,7 @@ import { useVoiceMode } from "@/hooks/useVoiceMode";import { useSectionHealth } from "@/hooks/useProviders";import { usePluginAttention } from "@/hooks/usePluginAttention";import { cn } from "@/lib/utils";-import { useMemo } from "react";+import { useMemo, useState } from "react";import { useT } from "@/i18n";import { BrowserRealtimeControl } from "@/components/voice/BrowserRealtimeControl";@@ -54,6 +54,12 @@ function resolveNavLabel(t: (key: string) => string, item: NavItem): string {return resolved === item.labelKey && item.fallbackLabel ? item.fallbackLabel : resolved;}+// A logo request that fails once (backend restarting, dist mid-rebuild) would+// otherwise stick as the browser's broken-image glyph forever — an <img> never+// retries on its own. Bounded cache-busted retries let it heal itself.+const LOGO_RETRY_MAX = 5;+const LOGO_RETRY_BASE_MS = 1500;+// Sidebar nav, clustered into logical groups separated by a thin divider:// 1) daily tools 2) content & data 3) configuration 4) social links.// The render walks the groups in order and draws a separator between them, so@@ -219,6 +225,8 @@ export function Sidebar() {: voiceMode.activeModel ?? "": brainModel;+ const [logoRetry, setLogoRetry] = useState(0);+return (<aside className="flex h-full w-[280px] shrink-0 flex-col border-r border-border bg-card/40 backdrop-blur"><div className="border-b border-border px-4 py-4">@@ -232,11 +240,23 @@ export function Sidebar() {className="flex h-11 w-11 shrink-0 items-center justify-center"><img- src="/jarvis-logo.png"+ src={+ logoRetry === 0+ ? "/jarvis-logo.png"+ : `/jarvis-logo.png?retry=${logoRetry}`+ }width={40}height={40}alt="Personal Jarvis"className="shrink-0"+ onError={() => {+ if (logoRetry < LOGO_RETRY_MAX) {+ window.setTimeout(+ () => setLogoRetry((n) => n + 1),+ (logoRetry + 1) * LOGO_RETRY_BASE_MS,+ );+ }+ }}/></span><div className="flex min-w-0 flex-1 flex-col">diff --git a/jarvis/ui/web/server.py b/jarvis/ui/web/server.pyindex 18ce026746..b94d0e2532 100644--- a/jarvis/ui/web/server.py+++ b/jarvis/ui/web/server.py@@ -15,7 +15,7 @@ from __future__ import annotationsimport asyncioimport osimport time-from pathlib import Path+from pathlib import Path, PurePosixPathfrom typing import TYPE_CHECKING, Anyfrom uuid import uuid4@@ -44,6 +44,7 @@ from jarvis.core.events import (from jarvis.core.registry import list_all_pluginsfrom jarvis.terminal import PtyManager, discover_shells, get_shell+from .fast_bootstrap import ASSET_SUFFIXESfrom .schema import (WSCommand,WSMessageIn,@@ -1693,6 +1694,12 @@ class WebServer:return FileResponse(str(target))except (OSError, ValueError):pass+ # A missing asset (image/script/font) gets an honest 404, never the+ # SPA index: an <img> that receives HTML with a 200 renders as a+ # permanently broken image — the browser treats the load as a+ # success and never retries (sidebar-logo regression, 2026-07-18).+ if PurePosixPath(full_path).suffix.lower() in ASSET_SUFFIXES:+ return JSONResponse({"detail": "Not Found"}, status_code=404)return self._spa_index_response()def _spa_index_response(self) -> FileResponse | HTMLResponse:diff --git a/tests/unit/ui/web/test_fast_bootstrap.py b/tests/unit/ui/web/test_fast_bootstrap.pyindex 8422e0719b..fd722dd800 100644--- a/tests/unit/ui/web/test_fast_bootstrap.py+++ b/tests/unit/ui/web/test_fast_bootstrap.py@@ -229,6 +229,22 @@ async def test_spa_fallback_serves_index_for_unknown_route(tmp_path) -> None:assert b"<div id=root>" in _body(sent)+async def test_missing_asset_is_held_never_answered_with_index_html(tmp_path) -> None:+ # An asset extension the build ships (.png/.js/...) that misses on disk —+ # the mid-rebuild dist window — must NOT get the SPA index.html fallback:+ # an <img> that receives HTML with a 200 renders as a permanently broken+ # image and the browser never retries (2026-07-18 sidebar-logo regression).+ # Holding lets the real app answer honestly (file or 404) once ready.+ bs = FastBootstrap(+ dist_dir=_seed_dist(tmp_path), hold_timeout=0.05, session_token=_TOKEN+ )+ cookie = await _exchange(bs)+ sent = await _drive(bs.app, _http("/jarvis-logo.png", cookie=cookie))+ assert _status(sent) == 503 # held → warming timeout, never index.html 200+ assert b"<div id=root>" not in _body(sent)++@pytest.mark.asyncioasync def test_api_request_is_still_held_not_served_as_static(tmp_path) -> None:# /api/* must NOT be served as static — it is the dynamic surface and mustdiff --git a/tests/unit/ui/web/test_spa_asset_fallback.py b/tests/unit/ui/web/test_spa_asset_fallback.pynew file mode 100644index 0000000000..e2beaa98f6--- /dev/null+++ b/tests/unit/ui/web/test_spa_asset_fallback.py@@ -0,0 +1,57 @@+"""The SPA fallback must never answer a missing ASSET with index.html.++An <img>/<script>/<link> that receives HTML with a 200 renders as permanently+broken — the browser records the load as a success and never retries. That is+exactly how the sidebar logo froze into the broken-image glyph during a+mid-rebuild dist window (2026-07-18). Missing files with a build-shipped asset+extension get an honest 404; extensionless client-side routes still fall back+to index.html so deep links keep working.+"""+from __future__ import annotations++from types import SimpleNamespace++from fastapi import FastAPI+from fastapi.testclient import TestClient++import jarvis.ui.web.server as server_mod+++def _client(tmp_path, monkeypatch) -> tuple[TestClient, object]:+ dist = tmp_path / "dist"+ (dist / "assets").mkdir(parents=True)+ (dist / "index.html").write_text(+ "<!doctype html><html><body><div id=root></div></body></html>",+ encoding="utf-8",+ )+ monkeypatch.setattr(server_mod, "DIST_DIR", dist)+ monkeypatch.setattr(server_mod, "INDEX_FILE", dist / "index.html")+ monkeypatch.setattr(server_mod, "ASSETS_DIR", dist / "assets")++ app = FastAPI()+ stub = SimpleNamespace(cfg=SimpleNamespace(ui=SimpleNamespace(dev_mode=False)))+ stub._spa_index_response = lambda: server_mod.WebServer._spa_index_response(stub) # type: ignore[arg-type]+ server_mod.WebServer._register_static_or_spa(stub, app) # type: ignore[arg-type]+ return TestClient(app), dist+++def test_missing_asset_gets_honest_404_not_index_html(tmp_path, monkeypatch) -> None:+ client, _dist = _client(tmp_path, monkeypatch)+ response = client.get("/jarvis-logo.png")+ assert response.status_code == 404+ assert b"<div id=root>" not in response.content+++def test_client_side_route_still_falls_back_to_index(tmp_path, monkeypatch) -> None:+ client, _dist = _client(tmp_path, monkeypatch)+ response = client.get("/wiki/some/page")+ assert response.status_code == 200+ assert b"<div id=root>" in response.content+++def test_existing_asset_is_served_as_is(tmp_path, monkeypatch) -> None:+ client, dist = _client(tmp_path, monkeypatch)+ (dist / "jarvis-logo.png").write_bytes(b"\x89PNG\r\n\x1a\n fake-png-body")+ response = client.get("/jarvis-logo.png")+ assert response.status_code == 200+ assert response.content.startswith(b"\x89PNG")