Skip to content

The agent that grows with you

fix(update): stop rendering 'managed outside dashboard' as a shell command

kshitijk4poor4c1fd5bc05f8
diff --git a/apps/desktop/src/store/updates.test.ts b/apps/desktop/src/store/updates.test.ts
index 19d89d21862..3a53a4c25bc 100644
--- a/apps/desktop/src/store/updates.test.ts
+++ b/apps/desktop/src/store/updates.test.ts
@@ -432,7 +432,7 @@ describe('checkBackendUpdates', () => {
behind: -1,
update_available: true,
can_apply: false,
- update_command: 'managed outside dashboard',
+ update_command: '',
message: 'Update available.'
})
@@ -563,6 +563,34 @@ describe('requestActiveUpdate', () => {
requestActiveUpdate()
await vi.waitFor(() => expect(updateHermesSpy).toHaveBeenCalled())
})
+
+ it('shows the refusal message, not a fake command, when the backend has no command to run', async () => {
+ setRemote(true)
+ updateHermesSpy.mockResolvedValue({
+ ok: false,
+ name: 'hermes-update',
+ error: 'dashboard_update_managed_externally',
+ message: 'Hermes updates are managed outside this dashboard in containerized environments.',
+ update_command: ''
+ })
+
+ const result = await applyBackendUpdate()
+
+ expect(result.manual).toBe(true)
+ expect(result.command).toBeUndefined()
+ expect($backendUpdateApply.get().stage).toBe('manual')
+ expect($backendUpdateApply.get().command).toBeNull()
+ expect($backendUpdateApply.get().message).toContain('managed outside this dashboard')
+ })
+
+ it('falls back to `hermes update` only when an older backend omits update_command', async () => {
+ setRemote(true)
+ updateHermesSpy.mockResolvedValue({ ok: false, name: 'hermes-update', message: 'Run it yourself.' })
+
+ await applyBackendUpdate()
+
+ expect($backendUpdateApply.get().command).toBe('hermes update')
+ })
})
// Surface-bound update entry points. A surface that displays ONE target's
diff --git a/apps/desktop/src/store/updates.ts b/apps/desktop/src/store/updates.ts
index 514d478ce25..3b9c06719c3 100644
--- a/apps/desktop/src/store/updates.ts
+++ b/apps/desktop/src/store/updates.ts
@@ -851,10 +851,13 @@ async function runBackendUpdate(): Promise<DesktopUpdateApplyResult> {
if (!started.ok) {
const message = (started as { message?: string }).message || translateNow('updates.applyStatus.notAvailable')
- const command = (started as { update_command?: string }).update_command || 'hermes update'
- $backendUpdateApply.set({ ...IDLE, applying: false, stage: 'manual', message, command })
+ // An empty update_command is the backend saying "there is no command to
+ // run here" (managed container, commit build) — render the message-only
+ // view. Only a field absent from an older backend falls back.
+ const command = (started as { update_command?: string | null }).update_command ?? 'hermes update'
+ $backendUpdateApply.set({ ...IDLE, applying: false, stage: 'manual', message, command: command || null })
- return { ok: false, error: 'manual', manual: true, message, command }
+ return { ok: false, error: 'manual', manual: true, message, command: command || undefined }
}
$backendUpdateApply.set({
diff --git a/hermes_cli/web_routers/actions.py b/hermes_cli/web_routers/actions.py
index bd968c86edb..966662c5693 100644
--- a/hermes_cli/web_routers/actions.py
+++ b/hermes_cli/web_routers/actions.py
@@ -225,7 +225,8 @@ async def update_hermes():
if _dashboard_local_update_managed_externally():
message = _MANAGED_EXTERNALLY_MESSAGE + " The built-in local updater is disabled here."
- return _update_refused("dashboard_update_managed_externally", message, "managed outside dashboard")
+ # No runnable command exists here: the outer launcher/image owns updates.
+ return _update_refused("dashboard_update_managed_externally", message, "")
# Shared admission gate: marker-first, then the docker/nix/apt heuristics —
# one decision with the CLI paths.
@@ -284,7 +285,7 @@ async def check_hermes_update(force: bool = False, profile: Optional[str] = None
"current_version": get_version_info().derived_version,
"behind": None,
"update_available": False, "can_apply": False,
- "update_command": "managed outside dashboard", "message": _MANAGED_EXTERNALLY_MESSAGE,
+ "update_command": "", "message": _MANAGED_EXTERNALLY_MESSAGE,
}
install_method = detect_install_method(_server_path("PROJECT_ROOT"))
diff --git a/tests/hermes_cli/test_dashboard_admin_endpoints.py b/tests/hermes_cli/test_dashboard_admin_endpoints.py
index 536cafb4b47..d5177709cb9 100644
--- a/tests/hermes_cli/test_dashboard_admin_endpoints.py
+++ b/tests/hermes_cli/test_dashboard_admin_endpoints.py
@@ -837,6 +837,14 @@ class TestUpdateCheckEndpoint:
assert body["update_available"] is False
assert body["behind"] is None
assert "managed outside this dashboard" in body["message"]
+ # No runnable command exists; clients render update_command verbatim
+ # as a copyable shell line, so prose here is a fake command.
+ assert body["update_command"] == ""
+
+ refused = self.client.post("/api/hermes/update").json()
+ assert refused["ok"] is False
+ assert refused["error"] == "dashboard_update_managed_externally"
+ assert refused["update_command"] == ""
class TestDebugShareEndpoint: