The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): a Desktop-only Node dependency failure no longer blocks the TUI and web UI
Teknium73162b00eefd
diff --git a/hermes_cli/source_build.py b/hermes_cli/source_build.pyindex 606208b715c..286db75ae4c 100644--- a/hermes_cli/source_build.py+++ b/hermes_cli/source_build.py@@ -127,6 +127,10 @@ def _failure_text(exc: BaseException) -> str:return f"{type(exc).__name__}: {exc}" if str(exc) else type(exc).__name__+def _headless_linux() -> bool:+ return sys.platform.startswith("linux") and not (os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"))++def build_update_products(project_root: Path, *, desktop: bool) -> None:"""Prepare the selected union once, attempting every independent product.@@ -157,15 +161,29 @@ def build_update_products(project_root: Path, *, desktop: bool) -> None:workspaces = frontends + (("apps/desktop",) if desktop else ())publish_stage("Updating Node dependencies")- def node_dependencies() -> None:+ def node_dependencies(selected: tuple[str, ...]) -> None:# Acquiring npm is part of this step: its failure must be reported like the install's.# A recorded install is trusted as at startup (re-hashing node+npm costs ~2 s per# tail); a missing one is still installed explicitly.env.update(source_build_env(explicit=True, verify=False))- prepare_source_dependencies(project_root, workspaces, env=env, explicit=True)+ prepare_source_dependencies(project_root, selected, env=env, explicit=True)# Every product compiles from these node_modules: without them there is nothing to build.- if attempt("Node dependencies", node_dependencies):+ prepared = attempt("Node dependencies", lambda: node_dependencies(workspaces))+ desktop_skipped = False+ if not prepared and desktop and env:+ # Only apps/desktop brings native addons (node-pty, electron) into the union: a host+ # whose compiler cannot build them must still get the TUI and web UI it runs.+ print(" → Retrying Node dependencies without the desktop app")+ failed = failures.pop()+ prepared = desktop_skipped = attempt("Node dependencies", lambda: node_dependencies(frontends))+ if desktop_skipped:+ failures.append(("desktop dependencies", failed[1]))+ desktop_reason = failures[-1][0] if failures else ""+ if desktop and (desktop_skipped or _headless_linux()):+ print(" ⓘ If this host never runs the desktop app, `hermes uninstall --gui` removes it "+ "and future updates stop building it.")+ if prepared:# An update that changed no TUI/web input reuses the receipted output, as the# launch path already does; recompiling it produces the same bytes. Desktop# additionally needs the packaged app to name HEAD (its baked stamp carries the@@ -183,12 +201,13 @@ def build_update_products(project_root: Path, *, desktop: bool) -> None:else:publish_stage("Building the web UI")attempt("web UI build", lambda: build_source_web(project_root, env=env))- if desktop:+ if desktop and not desktop_skipped:desktop_built = attempt("desktop app build", lambda: _build_desktop_product(project_root, env, publish_stage))+ desktop_reason = failures[-1][0] if not desktop_built else ""if desktop and not desktop_built:# One whole line the Desktop hand-off scripts match: the follow-up text is truncated# and names whichever products failed first, so it cannot say if THIS app was rebuilt.- print(f" Desktop app build owed: {failures[-1][0]} failed")+ print(f" Desktop app build owed: {desktop_reason} failed")# A configured memory provider that no longer ships in core is installed from the# catalog for every profile home sharing this venv (config, data and tool names# unchanged). The update must finish even if the migration blows up.diff --git a/tests/hermes_cli/test_source_build.py b/tests/hermes_cli/test_source_build.pyindex 237759c1201..23fdd980946 100644--- a/tests/hermes_cli/test_source_build.py+++ b/tests/hermes_cli/test_source_build.py@@ -350,6 +350,25 @@ def test_unbuilt_desktop_is_named_on_one_whole_line(source_products, monkeypatchassert [line for line in lines if line.startswith("Desktop app build owed:")] == [expected][email protected]("linux")+def test_desktop_dependency_failure_still_builds_the_tui_and_web_ui(source_products, capsys):+ # A host whose compiler rejects a Desktop-only native addon (node-pty on g++ 9) used to lose+ # every frontend with it: the union npm ci failed and nothing was built.+ from hermes_cli.source_build import ProductBuildError, build_update_products++ root, _ = source_products+ manifest = root / "apps/desktop/package.json"+ manifest.write_text(json.dumps({**json.loads(manifest.read_text()), "scripts": {"postinstall": "exit 1"}}))+ with pytest.raises(ProductBuildError) as failure:+ build_update_products(root, desktop=True)+ assert [name for name, _ in failure.value.failures] == ["desktop dependencies"]+ assert [event["step"] for event in _events(root)] == ["deps", "tui", "web"]+ assert not (root / "node_modules/apps-desktop").exists()+ out = capsys.readouterr().out+ assert "Desktop app build owed: desktop dependencies failed" in out+ assert "hermes uninstall --gui" in out++@pytest.mark.platforms("linux")@pytest.mark.parametrize("desktop", [False, True])def test_module_cli_builds_the_requested_products(source_products, desktop, monkeypatch):diff --git a/website/docs/user-guide/desktop.md b/website/docs/user-guide/desktop.mdindex d6c7fdd6dc2..7f8700bd056 100644--- a/website/docs/user-guide/desktop.md+++ b/website/docs/user-guide/desktop.md@@ -398,6 +398,8 @@ Preview GUI cleanup with `hermes uninstall --gui --dry-run`. It lists the removaRunning `hermes uninstall --gui` from a **source checkout** (a `hermes desktop` dev build) removes `apps/desktop/{dist,release,node_modules}` and the desktop build stamp. The workspace-root `node_modules` stays installed because it is shared with the TUI, dashboard and other workspaces. Rebuild the GUI with `hermes desktop` if you need it again.:::+`hermes update` keeps a desktop app current once it has been built in the checkout, even on a server that never opens it. On a headless Linux host, or when the desktop app's own Node dependencies fail to install (for example a compiler too old for `node-pty`), the update still builds the TUI and web UI, reports the desktop build as owed, and suggests `hermes uninstall --gui`. After that uninstall, later updates skip the desktop app.+## CLI reference: `hermes desktop`To launch via the CLI, simply run `hermes desktop`. By default it installs workspace Node dependencies, builds the current OS's unpacked Electron app, then launches that packaged artifact.