Skip to content

The agent that grows with you

fix(desktop): keep an older Desktop's dashboard fallback starting (review)

alt-glitch328e19cefab9
diff --git a/hermes_cli/main.py b/hermes_cli/main.py
index fa950cc6dbb..e597ce70aee 100644
--- a/hermes_cli/main.py
+++ b/hermes_cli/main.py
@@ -2536,8 +2536,19 @@ def _dashboard_sanitize_desktop_env(headless_backend) -> None:
overrides (dev / custom builds) must still work, while headless `serve`
keeps the packaged path used by the Desktop backend. Headless `serve`
re-sets HERMES_SERVE_HEADLESS itself.
+
+ The Desktop's legacy fallback spawn (`dashboard --no-open`, taken when the
+ `serve --help` probe times out on a cold host) is not headless yet must keep
+ its packaged dist: it is told apart by the per-spawn
+ HERMES_DASHBOARD_SESSION_TOKEN, which the terminal pane never receives and
+ the terminal tool's env policy strips from agent children.
"""
- if not headless_backend and _is_electron_packaged_web_dist(os.environ.get("HERMES_WEB_DIST", "")):
+ desktop_owned_child = _is_desktop_owned_backend()
+ if (
+ not headless_backend
+ and not desktop_owned_child
+ and _is_electron_packaged_web_dist(os.environ.get("HERMES_WEB_DIST", ""))
+ ):
os.environ.pop("HERMES_WEB_DIST", None)
if not headless_backend:
os.environ.pop("HERMES_SERVE_HEADLESS", None)
diff --git a/tests/hermes_cli/test_dashboard_web_dist_validation.py b/tests/hermes_cli/test_dashboard_web_dist_validation.py
index 3717677e99d..b4e9c772ddf 100644
--- a/tests/hermes_cli/test_dashboard_web_dist_validation.py
+++ b/tests/hermes_cli/test_dashboard_web_dist_validation.py
@@ -165,3 +165,17 @@ def test_desktop_headless_serve_keeps_packaged_renderer(main_mod, monkeypatch):
main_mod._dashboard_sanitize_desktop_env(headless_backend=True)
assert os.environ["HERMES_WEB_DIST"] == packaged
+
+
+def test_desktop_owned_fallback_dashboard_keeps_packaged_renderer(main_mod, monkeypatch):
+ """The Desktop's own legacy `dashboard --no-open` fallback spawn (serve probe
+ timed out) is not headless but carries the per-spawn session token; stripping
+ its dist would send a packaged install into `_build_web_ui(fatal=True)`."""
+ packaged = "/Applications/Hermes.app/Contents/Resources/app.asar.unpacked/dist"
+ monkeypatch.setenv("HERMES_DESKTOP", "1")
+ monkeypatch.setenv("HERMES_DASHBOARD_SESSION_TOKEN", "desktop-spawn-token")
+ monkeypatch.setenv("HERMES_WEB_DIST", packaged)
+
+ main_mod._dashboard_sanitize_desktop_env(headless_backend=False)
+
+ assert os.environ["HERMES_WEB_DIST"] == packaged