Simplify dashboard update detection to containers

This commit is contained in:
Shannon Sands 2026-06-16 12:57:28 +10:00 committed by Teknium
parent b1d6a57883
commit 7cd71de1f4
3 changed files with 13 additions and 18 deletions

View file

@ -1227,15 +1227,11 @@ def _default_hermes_root_is_opt_data() -> bool:
def _dashboard_local_update_managed_externally() -> bool:
"""Return true when the dashboard should not offer ``hermes update``.
Hosted agent dashboards run with the Hermes root at ``/opt/data``. Generic
containerized dashboards may not use that exact root, but their lifecycle is
still owned by the outer launcher/image, not by an in-browser local update
action. Keep this dashboard capability separate from install-method
detection: manual git/pip installs inside containers can still behave like
their actual install method in the CLI.
Containerized dashboards are updated by the outer launcher/image, not by an
in-browser local update action. Keep this dashboard capability separate
from install-method detection: manual git/pip installs inside containers can
still behave like their actual install method in the CLI.
"""
if _default_hermes_root_is_opt_data():
return True
try:
from hermes_constants import is_container
@ -2188,7 +2184,7 @@ async def update_hermes():
"""Kick off ``hermes update`` in the background."""
if _dashboard_local_update_managed_externally():
message = (
"Hermes updates are managed outside this dashboard for hosted or "
"Hermes updates are managed outside this dashboard in "
"containerized environments. The built-in local updater is "
"disabled here."
)
@ -2310,8 +2306,8 @@ async def check_hermes_update(force: bool = False):
"can_apply": False,
"update_command": "managed outside dashboard",
"message": (
"Hermes updates are managed outside this dashboard for hosted "
"or containerized environments."
"Hermes updates are managed outside this dashboard in "
"containerized environments."
),
}

View file

@ -772,7 +772,7 @@ class TestUpdateCheckEndpoint:
assert body["message"]
assert body["behind"] is None
def test_hosted_dashboard_is_not_applyable(self, monkeypatch):
def test_managed_runtime_dashboard_is_not_applyable(self, monkeypatch):
import hermes_cli.web_server as ws
monkeypatch.setattr(ws, "_dashboard_local_update_managed_externally", lambda: True)
@ -780,7 +780,7 @@ class TestUpdateCheckEndpoint:
ws,
"detect_install_method",
lambda *a, **k: pytest.fail(
"hosted update check should not probe install method"
"managed runtime update check should not probe install method"
),
)

View file

@ -247,7 +247,7 @@ class TestWebServerEndpoints:
assert "active_sessions" in data
assert data["can_update_hermes"] is True
def test_get_status_hides_update_capability_in_hosted_mode(self, monkeypatch):
def test_get_status_hides_update_capability_in_managed_runtime(self, monkeypatch):
import hermes_cli.web_server as web_server
monkeypatch.setattr(web_server, "_dashboard_local_update_managed_externally", lambda: True)
@ -260,7 +260,6 @@ class TestWebServerEndpoints:
import hermes_constants
import hermes_cli.web_server as web_server
monkeypatch.setattr(web_server, "_default_hermes_root_is_opt_data", lambda: False)
monkeypatch.setattr(hermes_constants, "is_container", lambda: True)
assert web_server._dashboard_local_update_managed_externally() is True
@ -931,7 +930,7 @@ class TestWebServerEndpoints:
assert status_data["pid"] is None
assert any("docker pull nousresearch/hermes-agent:latest" in line for line in status_data["lines"])
def test_update_hermes_returns_hosted_guidance_without_spawning(self, monkeypatch):
def test_update_hermes_returns_managed_runtime_guidance_without_spawning(self, monkeypatch):
import hermes_cli.web_server as web_server
spawned = False
@ -940,12 +939,12 @@ class TestWebServerEndpoints:
def fail_spawn(*_args, **_kwargs):
nonlocal spawned
spawned = True
raise AssertionError("hosted update guard should not spawn hermes update")
raise AssertionError("managed runtime update guard should not spawn hermes update")
def fail_detect(*_args, **_kwargs):
nonlocal detected
detected = True
raise AssertionError("hosted update guard should not detect install method")
raise AssertionError("managed runtime update guard should not detect install method")
monkeypatch.setattr(web_server, "_dashboard_local_update_managed_externally", lambda: True)
monkeypatch.setattr(web_server, "detect_install_method", fail_detect)