Skip to content

The agent that grows with you

fix(local-runtime): the CLI boots the managed server for an explicit backend

teknium1ffbecdca20a1
diff --git a/hermes_cli/local_runtime/endpoint.py b/hermes_cli/local_runtime/endpoint.py
index de0d67d8019..34c3e98a61d 100644
--- a/hermes_cli/local_runtime/endpoint.py
+++ b/hermes_cli/local_runtime/endpoint.py
@@ -138,10 +138,10 @@ def _kick_managed_boot(config: dict | None) -> None:
def _boot_in_flight(config: dict | None) -> bool:
"""True when the managed runtime is enabled and PM holds an installed engine."""
with suppress(Exception):
- config = _load_config_if_none(config)
- if not ((config or {}).get("local_runtime") or {}).get("enabled"):
+ section = (_load_config_if_none(config) or {}).get("local_runtime") or {}
+ if not section.get("enabled"):
return False
from hermes_cli.local_runtime.binaries import installed_engine
- return installed_engine() is not None
+ return installed_engine(section.get("backend") or "auto") is not None
return False
diff --git a/tests/hermes_cli/test_local_runtime.py b/tests/hermes_cli/test_local_runtime.py
index c814ea35249..18758b99507 100644
--- a/tests/hermes_cli/test_local_runtime.py
+++ b/tests/hermes_cli/test_local_runtime.py
@@ -484,18 +484,24 @@ def test_resolution_kicks_boot_when_no_thread_is_booting(tmp_path, monkeypatch):
def test_boot_in_flight_real_gate(tmp_path, monkeypatch):
"""_boot_in_flight exercised FOR REAL (the previous regression test
monkeypatched it — and the real one threw TypeError on every call,
- silently disabling the boot wait). Enabled + installed PM engine
- -> True; either missing -> False."""
+ silently disabling the boot wait). Enabled + an installed PM engine for
+ the CONFIGURED backend -> True; either missing -> False."""
monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
from hermes_cli.local_runtime import endpoint as ep
- monkeypatch.setattr("hermes_cli.local_runtime.binaries.installed_engine", lambda: None)
+ installed: set[str] = set()
+ monkeypatch.setattr("hermes_cli.local_runtime.binaries.installed_engine",
+ lambda backend="auto", **_: object() if backend in installed else None)
enabled = {"local_runtime": {"enabled": True}}
assert ep._boot_in_flight(enabled) is False
- monkeypatch.setattr("hermes_cli.local_runtime.binaries.installed_engine", lambda: object())
+ installed.add("auto")
assert ep._boot_in_flight(enabled) is True
# Disabled -> False even when installed.
assert ep._boot_in_flight({"local_runtime": {"enabled": False}}) is False
+ # An explicit backend is the engine that boots: only the Vulkan build installed must count.
+ installed.clear()
+ installed.add("vulkan")
+ assert ep._boot_in_flight({"local_runtime": {"enabled": True, "backend": "vulkan"}}) is True
def test_idle_sweep_unloads_idle_models(tmp_path, monkeypatch, stub_server):