The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): offer a restart when the updated app is already on disk
Brooklyn Nicholson5fe9e209dc66
diff --git a/apps/desktop/electron/bundle-skew.test.ts b/apps/desktop/electron/bundle-skew.test.tsindex e636aa6ca53..cbf3453f5a2 100644--- a/apps/desktop/electron/bundle-skew.test.ts+++ b/apps/desktop/electron/bundle-skew.test.ts@@ -5,7 +5,7 @@ import { dirname, join } from 'node:path'import { afterAll, describe, expect, it } from 'vitest'-import { detectBundleSkew, isFallbackCommit, RUNTIME_PATHS, type RunGit } from './bundle-skew'+import { detectBundleSkew, isFallbackCommit, type RunGit, RUNTIME_PATHS } from './bundle-skew'const REPO = '/repo'const STAMP = { commit: 'a'.repeat(40), source: 'ci' }diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex e6ed368d825..792fff541fd 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -17241,10 +17241,26 @@ ipcMain.handle('hermes:version', async () => {platform: process.platform,hermesRoot: resolveUpdateRoot(),bundleOutOfSync: skew.outOfSync,- bundleCommitsBehind: skew.desktopCommitsBehind+ bundleCommitsBehind: skew.desktopCommitsBehind,+ // True when the bundle on disk is not the one this process loaded — a+ // plain app restart (no rebuild, no installer) clears the skew above.+ // Packaged only: a dev `--build-only` rewrites build/install-stamp.json+ // under a running `npm start`, which is a rebuild the developer asked for,+ // not a torn install to offer a restart for.+ bundleSwapPending: IS_PACKAGED && detectBundleSwap(INSTALL_STAMP, loadInstallStamp())}})+// The About page's "Restart Hermes" button (shown when bundleSwapPending):+// load the already-swapped bundle without asking the user to quit manually.+// app.relaunch() re-executes by path, so the fresh process picks up whatever+// bundle now lives there.+ipcMain.handle('hermes:app:relaunch', async () => {+ rememberLog('[updates] renderer requested an app relaunch (swapped bundle pending)')+ app.relaunch({ args: buildNoSandboxRelaunchArgs(process.argv.slice(1)) })+ void exitAfterBackendShutdown(0)+})+// ===========================================================================// Uninstall — remove the Chat GUI (and optionally the agent / user data).// ===========================================================================diff --git a/apps/desktop/electron/preload.ts b/apps/desktop/electron/preload.tsindex b14d6bed488..8176ebfc07e 100644--- a/apps/desktop/electron/preload.ts+++ b/apps/desktop/electron/preload.ts@@ -491,6 +491,7 @@ contextBridge.exposeInMainWorld('hermesDesktop', {return () => ipcRenderer.removeListener('hermes:bootstrap:event', listener)},getVersion: () => ipcRenderer.invoke('hermes:version'),+ relaunchApp: () => ipcRenderer.invoke('hermes:app:relaunch'),getRemoteDisplayReason: () => ipcRenderer.invoke('hermes:get-remote-display-reason'),uninstall: {summary: () => ipcRenderer.invoke('hermes:uninstall:summary'),diff --git a/apps/desktop/src/app/settings/about-settings.tsx b/apps/desktop/src/app/settings/about-settings.tsxindex fa358a08dcf..8ff1e27e643 100644--- a/apps/desktop/src/app/settings/about-settings.tsx+++ b/apps/desktop/src/app/settings/about-settings.tsx@@ -107,27 +107,50 @@ export function AboutSettings() {{version?.appVersion ? a.version(version.appVersion) : a.versionUnavailable}</p></div>- {version?.bundleOutOfSync && (+ {(version?.bundleOutOfSync || version?.bundleSwapPending) && (<div className="mx-auto w-full max-w-2xl rounded-xl border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-left text-sm"><div className="flex items-start gap-2"><AlertTriangle className="mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400" /><div className="min-w-0">- <p className="font-medium">{a.bundleOutOfSync}</p>- <p className="mt-1 text-xs text-muted-foreground">{a.bundleOutOfSyncDesc}</p>- <Button asChild className="mt-2" size="sm" variant="textStrong">- <a- href={INSTALLER_URL}- onClick={event => {- event.preventDefault()- void window.hermesDesktop?.openExternal?.(INSTALLER_URL)- }}- rel="noreferrer"- target="_blank"- >- <ExternalLink className="size-3" />- {a.bundleOutOfSyncAction}- </a>- </Button>+ {version?.bundleSwapPending ? (+ // The updated app is already on disk — the updater swapped it+ // under this running process — so a restart loads it. Saying+ // "App build out of date" here would repeat the contradiction+ // this banner is meant to resolve: the Updates card below+ // already reports the runtime as current.+ <>+ <p className="font-medium">{a.bundleSwapPending}</p>+ <p className="mt-1 text-xs text-muted-foreground">{a.bundleSwapPendingDesc}</p>+ <Button+ className="mt-2"+ onClick={() => void window.hermesDesktop?.relaunchApp?.()}+ size="sm"+ variant="textStrong"+ >+ <RefreshCw className="size-3" />+ {a.bundleSwapPendingAction}+ </Button>+ </>+ ) : (+ <>+ <p className="font-medium">{a.bundleOutOfSync}</p>+ <p className="mt-1 text-xs text-muted-foreground">{a.bundleOutOfSyncDesc}</p>+ <Button asChild className="mt-2" size="sm" variant="textStrong">+ <a+ href={INSTALLER_URL}+ onClick={event => {+ event.preventDefault()+ void window.hermesDesktop?.openExternal?.(INSTALLER_URL)+ }}+ rel="noreferrer"+ target="_blank"+ >+ <ExternalLink className="size-3" />+ {a.bundleOutOfSyncAction}+ </a>+ </Button>+ </>+ )}</div></div></div>diff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.tsindex 07db15ab1ec..ec39041d5c2 100644--- a/apps/desktop/src/global.d.ts+++ b/apps/desktop/src/global.d.ts@@ -502,6 +502,8 @@ declare global {cancelBootstrap: () => Promise<{ ok: boolean; cancelled: boolean }>onBootstrapEvent: (callback: (payload: DesktopBootstrapEvent) => void) => () => voidgetVersion: () => Promise<DesktopVersionInfo>+ /** Restart the app in place — loads the swapped bundle when bundleSwapPending. */+ relaunchApp?: () => Promise<void>getRemoteDisplayReason?: () => Promise<string | null>updates: {check: () => Promise<DesktopUpdateStatus>@@ -582,6 +584,9 @@ export interface DesktopVersionInfo {bundleOutOfSync?: boolean/** Commits under apps/desktop/ the running bundle is missing (null unknown). */bundleCommitsBehind?: null | number+ /** True when the bundle on disk is newer than the running process — a plain+ * app restart (no rebuild, no installer) is enough to load it. */+ bundleSwapPending?: boolean}export type DesktopUninstallMode = 'full' | 'gui' | 'lite'diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex bbc975612ba..e8dbb901c0b 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -672,6 +672,10 @@ export const ar = defineLocale({bundleOutOfSyncDesc:'تم تحديث وقت تشغيل Hermes، لكن تطبيق سطح المكتب نفسه لا يزال إصدارًا قديمًا — لن تظهر ميزات الواجهة الجديدة (مثل Bot Mode) حتى يتم تحديث التطبيق. شغّل التحديث أدناه لإعادة بناء التطبيق. إذا لم يختفِ هذا التحذير، فأعد التثبيت من أحدث مثبّت لسطح المكتب.',bundleOutOfSyncAction: 'الحصول على المثبّت',+ bundleSwapPending: 'أعد التشغيل لإكمال التحديث',+ bundleSwapPendingDesc:+ 'تم تثبيت التطبيق المحدَّث بالفعل — يكفي إعادة تشغيل Hermes لتحميله. لن تتأثر المحادثات أو الإعدادات.',+ bundleSwapPendingAction: 'إعادة تشغيل Hermes',updates: 'التحديثات',checkNow: 'التحقق الآن',checking: 'جار التحقق...',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 7799845db07..3d80bf986ab 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -675,6 +675,10 @@ export const en: Translations = {bundleOutOfSyncDesc:'The Hermes runtime was updated, but the desktop app itself is still an older build — new interface features (like Bot Mode) will be missing until it updates. Run the update below to rebuild the app. If that doesn\u2019t clear this warning, reinstall from the latest desktop installer.',bundleOutOfSyncAction: 'Get the installer',+ bundleSwapPending: 'Restart to finish the update',+ bundleSwapPendingDesc:+ 'The updated app is already installed — Hermes only needs to restart to load it. Chats and settings are untouched.',+ bundleSwapPendingAction: 'Restart Hermes',updates: 'Updates',checkNow: 'Check now',checking: 'Checking…',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex aa971d9759c..cb00dc20d33 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -722,6 +722,10 @@ export const ja = defineLocale({bundleOutOfSyncDesc:'Hermes ランタイムは更新されましたが、デスクトップアプリ自体は古いビルドのままです。アプリを更新するまで、新しいインターフェース機能(Bot Mode など)は表示されません。下の更新を実行してアプリを再ビルドしてください。それでもこの警告が消えない場合は、最新のデスクトップインストーラーから再インストールしてください。',bundleOutOfSyncAction: 'インストーラーを入手',+ bundleSwapPending: '再起動して更新を完了',+ bundleSwapPendingDesc:+ '更新されたアプリはすでにインストール済みです。Hermes を再起動するだけで新しいビルドが読み込まれます。チャットや設定はそのまま保持されます。',+ bundleSwapPendingAction: 'Hermes を再起動',updates: '更新',checkNow: '今すぐ確認',checking: '確認中…',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 5d86f4c2286..22029d2feb4 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -560,6 +560,9 @@ export interface Translations {bundleOutOfSync: stringbundleOutOfSyncDesc: stringbundleOutOfSyncAction: string+ bundleSwapPending: string+ bundleSwapPendingDesc: string+ bundleSwapPendingAction: stringupdates: stringcheckNow: stringchecking: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 5d2bdd57cd6..aabbe6f4e1f 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -704,6 +704,9 @@ export const zhHant = defineLocale({bundleOutOfSyncDesc:'Hermes 執行環境已更新,但桌面應用程式本身仍是舊建置——在應用程式更新之前,新的介面功能(如 Bot Mode)不會顯示。請執行下方的更新以重新建置應用程式。如果此警告仍未消除,請從最新的桌面安裝程式重新安裝。',bundleOutOfSyncAction: '取得安裝程式',+ bundleSwapPending: '重新啟動以完成更新',+ bundleSwapPendingDesc: '更新後的應用程式已安裝完成,只需重新啟動 Hermes 即可載入新版本。聊天記錄和設定不會受到影響。',+ bundleSwapPendingAction: '重新啟動 Hermes',updates: '更新',checkNow: '立即檢查',checking: '檢查中…',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 523dc9da76f..de3d2fe7730 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -878,6 +878,9 @@ export const zh: Translations = {bundleOutOfSyncDesc:'Hermes 运行时已更新,但桌面应用本身仍是旧构建——在应用更新之前,新的界面功能(如 Bot Mode)不会显示。请运行下方的更新以重新构建应用。如果此警告仍未消除,请从最新的桌面安装程序重新安装。',bundleOutOfSyncAction: '获取安装程序',+ bundleSwapPending: '重启以完成更新',+ bundleSwapPendingDesc: '更新后的应用已安装完成,只需重启 Hermes 即可加载新版本。聊天记录和设置不会受到影响。',+ bundleSwapPendingAction: '重启 Hermes',updates: '更新',checkNow: '立即检查',checking: '检查中…',