Skip to content

The agent that grows with you

fix(desktop): skip self-refusing backends in Update everything; title refusals honestly

kshitijk4poor2e1d976235d9
diff --git a/apps/desktop/src/app/updates-overlay.manual.test.tsx b/apps/desktop/src/app/updates-overlay.manual.test.tsx
index f4949d2e7a1..8940e745817 100644
--- a/apps/desktop/src/app/updates-overlay.manual.test.tsx
+++ b/apps/desktop/src/app/updates-overlay.manual.test.tsx
@@ -4,6 +4,7 @@ import { afterEach, expect, it, vi } from 'vitest'
import { I18nProvider } from '@/i18n/context'
import { en } from '@/i18n/en'
import {
+ $backendUpdateApply,
$updateApply,
$updateOverlayOpen,
$updateOverlayTarget,
@@ -19,6 +20,7 @@ afterEach((): void => {
$updateOverlayOpen.set(false)
$updateStatus.set(null)
resetUpdateApplyState()
+ $backendUpdateApply.set({ ...$backendUpdateApply.get(), stage: 'idle', message: '', command: null, error: null })
Reflect.deleteProperty(window, 'hermesDesktop')
vi.restoreAllMocks()
})
@@ -46,3 +48,29 @@ it('shows manual recovery guidance without claiming the help command installs an
expect(screen.getByText('hermes update --help')).toBeTruthy()
expect(screen.queryByText(en.updates.manualPickedUp)).toBeNull()
})
+
+it('titles a command-less backend refusal honestly and offers nothing to copy', async (): Promise<void> => {
+ const message: string = 'Hermes updates are managed outside this dashboard in containerized environments.'
+ $updateOverlayTarget.set('backend')
+ $updateOverlayOpen.set(true)
+ $backendUpdateApply.set({
+ applying: false,
+ stage: 'manual',
+ message,
+ percent: null,
+ error: 'dashboard_update_managed_externally',
+ command: null,
+ log: []
+ })
+ await act(async (): Promise<void> => {
+ render(
+ <I18nProvider configClient={null} initialLocale="en">
+ <UpdatesOverlay />
+ </I18nProvider>
+ )
+ })
+ expect(screen.getByText(en.updates.manualUnavailableTitle)).toBeTruthy()
+ expect(screen.queryByText(en.updates.manualTitle)).toBeNull()
+ expect(screen.getByText(message)).toBeTruthy()
+ expect(screen.queryByText(en.updates.copy)).toBeNull()
+})
diff --git a/apps/desktop/src/app/updates-overlay.tsx b/apps/desktop/src/app/updates-overlay.tsx
index 1ee6209ca3c..209c53d1a7a 100644
--- a/apps/desktop/src/app/updates-overlay.tsx
+++ b/apps/desktop/src/app/updates-overlay.tsx
@@ -128,7 +128,12 @@ export function UpdatesOverlay() {
)}
{phase === 'manual' && (
- <ManualView command={apply.command ?? null} message={apply.message} onDone={() => handleClose(false)} />
+ <ManualView
+ command={apply.command ?? null}
+ message={apply.message}
+ onDone={() => handleClose(false)}
+ refused={apply.error !== null}
+ />
)}
{phase === 'guiSkew' && <GuiSkewView message={apply.message} onDone={() => handleClose(false)} />}
@@ -331,7 +336,17 @@ function IdleView({
)
}
-function ManualView({ command, message, onDone }: { command: string | null; message?: string; onDone: () => void }) {
+function ManualView({
+ command,
+ message,
+ onDone,
+ refused = false
+}: {
+ command: string | null
+ message?: string
+ onDone: () => void
+ refused?: boolean
+}) {
const { t } = useI18n()
const u = t.updates
const [copied, setCopied] = useState(false)
@@ -356,7 +371,9 @@ function ManualView({ command, message, onDone }: { command: string | null; mess
<div className="flex flex-col items-center gap-3 text-center">
<Terminal className="size-8 text-primary" />
- <DialogTitle className="text-center text-xl">{u.manualTitle}</DialogTitle>
+ <DialogTitle className="text-center text-xl">
+ {refused ? u.manualUnavailableTitle : u.manualTitle}
+ </DialogTitle>
<DialogDescription className="text-center text-sm">{message || u.manualPickedUp}</DialogDescription>
</div>
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index f215d79451b..6973e438b30 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -2657,6 +2657,7 @@ export const ar = defineLocale({
maybeLater: 'ربما لاحقا',
moreChanges: count => `+ ${count} تغيير${count === 1 ? '' : 'ات'} إضافي مُضمَّن.`,
manualTitle: 'التحديث من الطرفية',
+ manualUnavailableTitle: 'لا يمكن التحديث من هنا',
manualBody: 'لقد ثبّتت Hermes من سطر الأوامر، لذا تُجرى التحديثات من هناك أيضا. الصق هذا في طرفيتك:',
manualPickedUp: 'سيلتقط Hermes الإصدار الجديد في المرة التالية التي تشغّله فيها.',
guiSkewTitle: 'تحديث تطبيق سطح المكتب',
diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.ts
index b0fa136c8b6..2d0106944cf 100644
--- a/apps/desktop/src/i18n/de.ts
+++ b/apps/desktop/src/i18n/de.ts
@@ -4597,6 +4597,7 @@ export const deOverrides = {
maybeLater: 'Später',
moreChanges: count => `+ ${count} weitere Änderung${count === 1 ? '' : 'en'} enthalten.`,
manualTitle: 'Über Ihr Terminal aktualisieren',
+ manualUnavailableTitle: 'Aktualisierung hier nicht möglich',
manualBody:
'Sie haben Hermes über die Befehlszeile installiert, daher laufen Updates auch dort. Fügen Sie dies in Ihr Terminal ein:',
manualPickedUp: 'Hermes übernimmt die neue Version beim nächsten Start.',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 9de24f0f9d1..de79fe9af22 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -4161,6 +4161,7 @@ export const en: Translations = {
maybeLater: 'Maybe later',
moreChanges: count => `+ ${count} more change${count === 1 ? '' : 's'} included.`,
manualTitle: 'Update from your terminal',
+ manualUnavailableTitle: "Can't update from here",
manualBody: 'You installed Hermes from the command line, so updates run there too. Paste this into your terminal:',
manualPickedUp: 'Hermes will pick up the new version next time you launch it.',
guiSkewTitle: 'Update the desktop app',
diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.ts
index 6b337c1107e..311f77be59f 100644
--- a/apps/desktop/src/i18n/es.ts
+++ b/apps/desktop/src/i18n/es.ts
@@ -4590,6 +4590,7 @@ export const esOverrides = {
maybeLater: 'Quizá más tarde',
moreChanges: count => `+ ${count} ${count === 1 ? 'cambio incluido' : 'cambios incluidos'}.`,
manualTitle: 'Actualizar desde la terminal',
+ manualUnavailableTitle: 'No se puede actualizar desde aquí',
manualBody:
'Instalaste Hermes desde la línea de comandos, así que las actualizaciones también se ejecutan ahí. Pega esto en tu terminal:',
manualPickedUp: 'Hermes usará la nueva versión la próxima vez que lo abras.',
diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.ts
index 17d35d83480..aa7e9d90ead 100644
--- a/apps/desktop/src/i18n/fr.ts
+++ b/apps/desktop/src/i18n/fr.ts
@@ -4609,6 +4609,7 @@ export const frOverrides = {
moreChanges: count =>
`+ ${count} ${count === 1 ? 'changement supplémentaire inclus' : 'changements supplémentaires inclus'}.`,
manualTitle: 'Mise à jour depuis votre terminal',
+ manualUnavailableTitle: 'Mise à jour impossible ici',
manualBody:
"Vous avez installé Hermes depuis la ligne de commande, les mises à jour s'y effectuent donc aussi. Collez ceci dans votre terminal :",
manualPickedUp: 'Hermes prendra en compte la nouvelle version au prochain lancement.',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 57657c47339..065edfd567d 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -3035,6 +3035,7 @@ export const ja = defineLocale({
maybeLater: '後で',
moreChanges: count => `さらに ${count} 件の変更が含まれています。`,
manualTitle: 'ターミナルから更新',
+ manualUnavailableTitle: 'ここからは更新できません',
manualBody:
'Hermes をコマンドラインからインストールしたため、更新もそこで実行されます。これをターミナルに貼り付けてください:',
manualPickedUp: 'Hermes は次回起動時に新しいバージョンを読み込みます。',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index 0403ea42cf8..1a9ab7fc55e 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -3273,6 +3273,7 @@ export const ru = defineLocale({
maybeLater: 'Возможно позже',
moreChanges: count => `+ ещё ${count} ${RU_NOUN(count, 'изменение', 'изменения', 'изменений')} включено.`,
manualTitle: 'Обновление из терминала',
+ manualUnavailableTitle: 'Обновление здесь недоступно',
manualBody:
'Hermes установлен из командной строки, поэтому обновления тоже выполняются там. Вставьте это в терминал:',
manualPickedUp: 'Hermes подхватит новую версию при следующем запуске.',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index dd2bc8f100a..80cfcb8090a 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -3463,6 +3463,7 @@ export interface Translations {
maybeLater: string
moreChanges: (count: number) => string
manualTitle: string
+ manualUnavailableTitle: string
manualBody: string
manualPickedUp: string
/** GUI/backend skew (#45205): backend updated but the running desktop app
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index f97bf10f1e0..bc68344ecfb 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -3246,6 +3246,7 @@ export const zhHant = defineLocale({
maybeLater: '稍後再說',
moreChanges: count => `另有 ${count} 項變更。`,
manualTitle: '從終端機更新',
+ manualUnavailableTitle: '無法從這裡更新',
manualBody: '您是從命令列安裝的 Hermes,因此更新也需要在那裡執行。請將此指令貼到終端機:',
manualPickedUp: '下次啟動 Hermes 時會使用新版本。',
guiSkewTitle: '請更新桌面應用程式',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 10f2f98964b..c3cc732891d 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -3943,6 +3943,7 @@ export const zh = defineLocale({
maybeLater: '稍后再说',
moreChanges: count => `另有 ${count} 项更改。`,
manualTitle: '从终端更新',
+ manualUnavailableTitle: '无法从这里更新',
manualBody: '你是从命令行安装的 Hermes,因此更新也需要在那里运行。请将此命令粘贴到终端:',
manualPickedUp: '下次启动 Hermes 时会使用新版本。',
guiSkewTitle: '请更新桌面应用',
diff --git a/apps/desktop/src/store/updates.test.ts b/apps/desktop/src/store/updates.test.ts
index 3a53a4c25bc..8d9ba942732 100644
--- a/apps/desktop/src/store/updates.test.ts
+++ b/apps/desktop/src/store/updates.test.ts
@@ -580,6 +580,7 @@ describe('requestActiveUpdate', () => {
expect(result.command).toBeUndefined()
expect($backendUpdateApply.get().stage).toBe('manual')
expect($backendUpdateApply.get().command).toBeNull()
+ expect($backendUpdateApply.get().error).toBe('dashboard_update_managed_externally')
expect($backendUpdateApply.get().message).toContain('managed outside this dashboard')
})
@@ -776,6 +777,24 @@ describe('applyEverythingUpdate', () => {
expect(applyClientMock).not.toHaveBeenCalled()
})
+ it('remote mode: skips a backend that reported it cannot update itself, and says why', async () => {
+ setRemote(true)
+ $backendUpdateStatus.set(
+ status({ supported: false, message: 'Hermes updates are managed outside this dashboard.' })
+ )
+ checkClientMock.mockResolvedValue(status({ behind: 2, updateAvailable: true }))
+
+ await applyEverythingUpdate()
+
+ expect(updateHermesSpy).not.toHaveBeenCalled()
+ expect($backendUpdateApply.get().stage).toBe('idle')
+ expect(notifySpy).toHaveBeenCalledWith(
+ expect.objectContaining({ message: 'Hermes updates are managed outside this dashboard.' })
+ )
+ // The client leg still runs.
+ expect(applyClientMock).toHaveBeenCalledTimes(1)
+ })
+
it('fans out to other registered connections, excluding local and the active backend', async () => {
setRemote(true)
$mockConnectionsRegistry.set(registryOf(['local', 'vps', 'homelab']))
diff --git a/apps/desktop/src/store/updates.ts b/apps/desktop/src/store/updates.ts
index 3b9c06719c3..f4b772f88ec 100644
--- a/apps/desktop/src/store/updates.ts
+++ b/apps/desktop/src/store/updates.ts
@@ -855,7 +855,16 @@ async function runBackendUpdate(): Promise<DesktopUpdateApplyResult> {
// 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 })
+ $backendUpdateApply.set({
+ ...IDLE,
+ applying: false,
+ stage: 'manual',
+ message,
+ command: command || null,
+ // The backend refused (as opposed to "run this yourself"): the overlay
+ // titles a command-less refusal honestly instead of "from your terminal".
+ error: (started as { error?: string }).error || 'refused'
+ })
return { ok: false, error: 'manual', manual: true, message, command: command || undefined }
}
@@ -1063,7 +1072,17 @@ async function runEverythingUpdate(): Promise<void> {
// Its own finish path re-checks and nudges, but the everything-flow
// continues regardless of the outcome: one unreachable backend must
// not strand the other machines or the client.
- if (isRemoteMode()) {
+ // A backend that already reported it cannot update itself (managed
+ // container, commit build) is skipped with its own reason instead of
+ // being asked anyway, which only lands on a dead-end manual dialog.
+ const backendStatus = $backendUpdateStatus.get()
+
+ if (isRemoteMode() && backendStatus?.supported === false) {
+ notify({
+ title: translateNow('updates.availableTitleBackend'),
+ message: backendStatus.message || translateNow('updates.everythingSkipped')
+ })
+ } else if (isRemoteMode()) {
$updateOverlayTarget.set('backend')
await applyBackendUpdate().catch(() => null)