The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(web_server): a dashboard started without a build recovers the moment one appears (#82614)
Teknium20d33e385aae
diff --git a/contributors/emails/[email protected] b/contributors/emails/[email protected]new file mode 100644index 00000000000..ad639000816--- /dev/null+++ b/contributors/emails/[email protected]@@ -0,0 +1 @@+codexbtdiff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.pyindex 0aebafcd364..a6ddf3306ed 100644--- a/hermes_cli/web_server.py+++ b/hermes_cli/web_server.py@@ -17846,12 +17846,10 @@ def mount_spa(application: FastAPI):# SPA, even if a dist is lying around from a prior `dashboard`/build. Take# the no-frontend path so only the JSON-RPC/WS/API surface is reachable._headless = os.environ.get("HERMES_SERVE_HEADLESS") == "1"- if _headless or not WEB_DIST.exists():+ if _headless:_msg = ("Headless backend (hermes serve): web UI disabled — use ""`hermes dashboard` for the browser UI."- if _headless- else "Frontend not built. Run: cd web && npm run build")@application.get("/{full_path:path}")@@ -17859,6 +17857,18 @@ def mount_spa(application: FastAPI):return JSONResponse({"error": _msg}, status_code=404)return+ # A missing WEB_DIST is deliberately NOT a mount-time terminal state+ # (#82614): a long-lived `hermes dashboard --skip-build` process that+ # survives a `git pull` (or starts before the first build) used to+ # install a permanent no_frontend catch-all here and could never+ # recover — every route answered 404 "Frontend not built" until the+ # process was restarted, even after `npm run build` completed. The SPA+ # routes below all cope with a missing dist per-request (`_serve_index`+ # returns the same 404 JSON when index.html is unreadable; the asset+ # mounts use check_dir=False and 404 on missing files), so mounting+ # them unconditionally makes the dashboard recover the moment a build+ # appears on disk — no restart needed.+_index_path = WEB_DIST / "index.html"def _serve_index(prefix: str = ""):@@ -17974,7 +17984,12 @@ def mount_spa(application: FastAPI):return responseapplication.mount(- "/assets", _ImmutableAssetFiles(directory=WEB_DIST / "assets"), name="assets"+ "/assets",+ # check_dir=False: the dist (and its assets/ dir) may not exist yet —+ # the whole point of the dynamic recheck (#82614). StaticFiles then+ # 404s per-request until a build appears instead of raising at mount.+ _ImmutableAssetFiles(directory=WEB_DIST / "assets", check_dir=False),+ name="assets",)@application.get("/{full_path:path}")