The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a stable release older than the checkout is offered as a rollback (#137714)
Tekniume3533693c055
diff --git a/apps/desktop/src/app/command-palette/index.tsx b/apps/desktop/src/app/command-palette/index.tsxindex 892ec04edf2..2b41cb971b5 100644--- a/apps/desktop/src/app/command-palette/index.tsx+++ b/apps/desktop/src/app/command-palette/index.tsx@@ -61,6 +61,7 @@ import {} from '@/lib/icons'import { getServers } from '@/lib/mcp-servers'import { normalize } from '@/lib/text'+import { rollbackSentence } from '@/lib/update-copy'import { cn } from '@/lib/utils'import { resolveVersionStatus } from '@/lib/version-status'import { $repoWorktrees } from '@/store/coding-status'@@ -610,6 +611,7 @@ function CommandPaletteBody({ onExited }: { onExited: () => void }) {copy: t.shell.statusbar,latestTag: status?.latestTag,remote: backend,+ rollback: backend ? undefined : rollbackSentence(status, t.settings.about.channel.rollbackBody),restarting: apply.stage === 'restart',sha: status?.currentSha?.slice(0, 7) ?? null,target: backend ? 'backend' : 'client',diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsxindex 425d8836313..2e77e59a5b8 100644--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx@@ -36,6 +36,7 @@ import {import { type RuntimeReadinessResult } from '@/lib/runtime-readiness'import { resolveSessionTimerSince } from '@/lib/session-timer-since'import { cacheHitLabel, contextBarLabel, LiveDuration, tokensPerSecondLabel, usageContextLabel } from '@/lib/statusbar'+import { rollbackSentence } from '@/lib/update-copy'import { useStoreSelector } from '@/lib/use-session-slice'import { cn } from '@/lib/utils'import { resolveVersionStatus } from '@/lib/version-status'@@ -389,6 +390,10 @@ export function useStatusbarItems({copy,latestTag: updateStatus?.latestTag,remote: connection?.mode === 'remote',+ rollback: rollbackSentence(+ { rollback: updateStatus?.rollback, sourceVersion: updateStatus?.sourceVersion },+ t.settings.about.channel.rollbackBody+ ),restarting: updateApply.stage === 'restart',sha: updateStatus?.currentSha?.slice(0, 7) ?? null,target: 'client',@@ -422,7 +427,10 @@ export function useStatusbarItems({updateStatus?.channel,updateStatus?.currentSha,updateStatus?.latestTag,- updateStatus?.updateAvailable+ updateStatus?.rollback,+ updateStatus?.sourceVersion,+ updateStatus?.updateAvailable,+ t.settings.about.channel.rollbackBody])const backendVersionItem = useMemo<StatusbarItem | null>(() => {diff --git a/apps/desktop/src/app/updates-overlay.tsx b/apps/desktop/src/app/updates-overlay.tsxindex 1dd78e9c4c2..083f67723f3 100644--- a/apps/desktop/src/app/updates-overlay.tsx+++ b/apps/desktop/src/app/updates-overlay.tsx@@ -30,7 +30,7 @@ import type {import { useI18n } from '@/i18n'import { buildCommitChangelog, type CommitGroup, formatFullChangelogText } from '@/lib/commit-changelog'import { AlertCircle, Check, Copy, Terminal } from '@/lib/icons'-import { resolveUpdateCopy, type UpdateTarget } from '@/lib/update-copy'+import { resolveUpdateCopy, rollbackRelease, type UpdateTarget } from '@/lib/update-copy'import { cn } from '@/lib/utils'import {$backendUpdateApply,@@ -307,14 +307,20 @@ function IdleView({// show (e.g. pip/non-git backend), degrade to honest "no release notes" copy// instead of generic filler. On a release-feed channel (stable), name the// release tag instead of commit vocabulary.- const { title, body } = resolveUpdateCopy({- target,- shownItems,- channel: status?.channel === 'stable' ? 'stable' : 'main',- latestTag: status?.latestTag ?? null,- mechanism: status?.mechanism,- copy: u- })+ // A stable release this checkout already contains is a move back, never "a new update".+ const rollbackTag = target === 'client' ? rollbackRelease(status) : null+ const channelCopy = t.settings.about.channel++ const { title, body } = rollbackTag+ ? { title: channelCopy.rollbackTitle(rollbackTag), body: channelCopy.rollbackBody(rollbackTag) }+ : resolveUpdateCopy({+ target,+ shownItems,+ channel: status?.channel === 'stable' ? 'stable' : 'main',+ latestTag: status?.latestTag ?? null,+ mechanism: status?.mechanism,+ copy: u+ })const handleCopyFullLog = () => formatFullChangelogText(commits, behind, status.branch)diff --git a/apps/desktop/src/components/update-status.test.tsx b/apps/desktop/src/components/update-status.test.tsxindex 353401d89f6..5c576ea8e6b 100644--- a/apps/desktop/src/components/update-status.test.tsx+++ b/apps/desktop/src/components/update-status.test.tsx@@ -93,6 +93,31 @@ describe('deriveUpdateStatus', () => {expect(derive({ supported: true, behind: 0, branch: 'main' }).line).toBe(en.updates.latestBody)})+ it('names a stable release the checkout already contains as a rollback, never a new update', () => {+ const status = {+ supported: true,+ behind: -1,+ channel: 'stable',+ sourceVersion: '0.21.7',+ updateAvailable: true,+ aheadOfRelease: false+ }++ const view = (rollback: boolean) =>+ deriveUpdateStatus({+ apply: IDLE_APPLY,+ checking: false,+ rollback: en.settings.about.channel.rollbackBody,+ status: { ...status, rollback },+ target: 'client',+ u: en.updates+ }).line++ expect(view(true)).toBe(en.settings.about.channel.rollbackBody('v0.21.7'))+ expect(view(true)).not.toBe(en.updates.updateReadyUnknown)+ expect(view(false)).toBe(en.updates.updateReadyUnknown)+ })+it('never-checked: idle tone, invites a check', () => {const view = derive(null)diff --git a/apps/desktop/src/components/update-status.tsx b/apps/desktop/src/components/update-status.tsxindex 7a10c3dd99d..bce515e0714 100644--- a/apps/desktop/src/components/update-status.tsx+++ b/apps/desktop/src/components/update-status.tsx@@ -7,6 +7,7 @@ import { Codicon } from '@/components/ui/codicon'import type { DesktopUpdateStatus, DesktopVersionInfo } from '@/global'import { type Translations, useI18n } from '@/i18n'import { AlertTriangle, CheckCircle2, ExternalLink, Loader2, RefreshCw } from '@/lib/icons'+import { rollbackRelease } from '@/lib/update-copy'import { cn } from '@/lib/utils'import { shortVersion } from '@/lib/version-label'import {@@ -67,6 +68,8 @@ interface UpdateStatusInput {u: Translations['updates']/** Names the pinned release when a source install is current on stable. */latestRelease?: (version: string) => string+ /** Names a move back to an older stable release the checkout already contains. */+ rollback?: (version: string) => string}export function deriveUpdateStatus(input: UpdateStatusInput): UpdateStatusView {@@ -88,6 +91,7 @@ function ordinaryUpdateStatus({apply,checking,latestRelease,+ rollback,status,target,u@@ -119,9 +123,11 @@ function ordinaryUpdateStatus({}if (updateAvailable) {+ const back = target === 'client' && rollback ? rollbackRelease(status) : null+return {applying,- line: behind > 0 ? u.updateReady(behind) : u.updateReadyUnknown,+ line: back && rollback ? rollback(back) : behind > 0 ? u.updateReady(behind) : u.updateReadyUnknown,supported,tone: 'available',updateAvailable@@ -304,6 +310,7 @@ export function UpdateStatusCard({apply,checking,latestRelease: t.settings.about.channel.latestRelease,+ rollback: t.settings.about.channel.rollbackBody,status,target,udiff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.tsindex efefcb75ea6..a0ddabdadf5 100644--- a/apps/desktop/src/global.d.ts+++ b/apps/desktop/src/global.d.ts@@ -889,6 +889,8 @@ export interface DesktopUpdateStatus {sourceVersion?: string/** Source stable: true when forward-only (newer than the release); absent from older checkers. */aheadOfRelease?: boolean+ /** Source stable: the checkout already contains the release, so installing it moves back. */+ rollback?: booleantargetSha?: stringcommits?: DesktopUpdateCommit[]dirty?: booleandiff --git a/apps/desktop/src/i18n/ar_update_channel.ts b/apps/desktop/src/i18n/ar_update_channel.tsindex 520434c0eaf..ee05a9f17a3 100644--- a/apps/desktop/src/i18n/ar_update_channel.ts+++ b/apps/desktop/src/i18n/ar_update_channel.ts@@ -11,5 +11,8 @@ export const arUpdateChannel = {detailsLabel: 'القناة',branch: (b: string) => `الفرع: ${b}`,change: 'تغيير',- latestRelease: (v: string) => `أنت على أحدث إصدار مستقر (${v}).`+ latestRelease: (v: string) => `أنت على أحدث إصدار مستقر (${v}).`,+ rollbackTitle: (v: string) => `العودة إلى الإصدار المستقر ${v}`,+ rollbackBody: (v: string) =>+ `هذا الإصدار أحدث من الإصدار المستقر ${v}. سيعيد التثبيت Hermes إلى ذلك الإصدار.`}diff --git a/apps/desktop/src/i18n/de_update_channel.ts b/apps/desktop/src/i18n/de_update_channel.tsindex c4d3d1a1dd8..b67b0bb1fa8 100644--- a/apps/desktop/src/i18n/de_update_channel.ts+++ b/apps/desktop/src/i18n/de_update_channel.ts@@ -12,5 +12,8 @@ export const deUpdateChannel = {detailsLabel: 'Kanal',branch: (b: string) => `Branch: ${b}`,change: 'Ändern',- latestRelease: (v: string) => `Du nutzt das neueste stabile Release (${v}).`+ latestRelease: (v: string) => `Du nutzt das neueste stabile Release (${v}).`,+ rollbackTitle: (v: string) => `Zurück zum stabilen Release ${v}`,+ rollbackBody: (v: string) =>+ `Dieser Build ist neuer als das stabile Release ${v}. Die Installation setzt Hermes auf dieses Release zurück.`}diff --git a/apps/desktop/src/i18n/en_update_channel.ts b/apps/desktop/src/i18n/en_update_channel.tsindex cddf3efc39b..b41d4ee6aaa 100644--- a/apps/desktop/src/i18n/en_update_channel.ts+++ b/apps/desktop/src/i18n/en_update_channel.ts@@ -13,5 +13,8 @@ export const enUpdateChannel: UpdateChannelCopy = {detailsLabel: 'Channel',branch: (b: string) => `Branch: ${b}`,change: 'Change',- latestRelease: (v: string) => `You’re on the latest stable release (${v}).`+ latestRelease: (v: string) => `You’re on the latest stable release (${v}).`,+ rollbackTitle: (v: string) => `Back to stable release ${v}`,+ rollbackBody: (v: string) =>+ `This build is newer than the stable release ${v}. Installing it moves Hermes back to that release.`}diff --git a/apps/desktop/src/i18n/es_update_channel.ts b/apps/desktop/src/i18n/es_update_channel.tsindex 5f664fefbc0..f07ce54e947 100644--- a/apps/desktop/src/i18n/es_update_channel.ts+++ b/apps/desktop/src/i18n/es_update_channel.ts@@ -11,5 +11,8 @@ export const esUpdateChannel = {detailsLabel: 'Canal',branch: (b: string) => `Rama: ${b}`,change: 'Cambiar',- latestRelease: (v: string) => `Tienes la última versión estable (${v}).`+ latestRelease: (v: string) => `Tienes la última versión estable (${v}).`,+ rollbackTitle: (v: string) => `Volver a la versión estable ${v}`,+ rollbackBody: (v: string) =>+ `Esta compilación es más reciente que la versión estable ${v}. Al instalarla, Hermes vuelve a esa versión.`}diff --git a/apps/desktop/src/i18n/fr_update_channel.ts b/apps/desktop/src/i18n/fr_update_channel.tsindex f0158f69a91..1cc1021b9e0 100644--- a/apps/desktop/src/i18n/fr_update_channel.ts+++ b/apps/desktop/src/i18n/fr_update_channel.ts@@ -12,5 +12,8 @@ export const frUpdateChannel = {detailsLabel: 'Canal',branch: (b: string) => `Branche : ${b}`,change: 'Modifier',- latestRelease: (v: string) => `Vous utilisez la dernière version stable (${v}).`+ latestRelease: (v: string) => `Vous utilisez la dernière version stable (${v}).`,+ rollbackTitle: (v: string) => `Revenir à la version stable ${v}`,+ rollbackBody: (v: string) =>+ `Cette build est plus récente que la version stable ${v}. L’installer ramène Hermes à cette version.`}diff --git a/apps/desktop/src/i18n/ja_update_channel.ts b/apps/desktop/src/i18n/ja_update_channel.tsindex 0da61c9335c..e878c4be0e7 100644--- a/apps/desktop/src/i18n/ja_update_channel.ts+++ b/apps/desktop/src/i18n/ja_update_channel.ts@@ -12,5 +12,8 @@ export const jaUpdateChannel = {detailsLabel: 'チャンネル',branch: (b: string) => `ブランチ: ${b}`,change: '変更',- latestRelease: (v: string) => `最新の安定版リリース(${v})を使用しています。`+ latestRelease: (v: string) => `最新の安定版リリース(${v})を使用しています。`,+ rollbackTitle: (v: string) => `安定版リリース ${v} に戻す`,+ rollbackBody: (v: string) =>+ `このビルドは安定版リリース ${v} より新しいです。インストールすると Hermes はそのリリースに戻ります。`}diff --git a/apps/desktop/src/i18n/ru_update_channel.ts b/apps/desktop/src/i18n/ru_update_channel.tsindex 96b32362134..ab1713ae269 100644--- a/apps/desktop/src/i18n/ru_update_channel.ts+++ b/apps/desktop/src/i18n/ru_update_channel.ts@@ -12,5 +12,8 @@ export const ruUpdateChannel = {detailsLabel: 'Канал',branch: (b: string) => `Ветка: ${b}`,change: 'Изменить',- latestRelease: (v: string) => `У вас последний стабильный релиз (${v}).`+ latestRelease: (v: string) => `У вас последний стабильный релиз (${v}).`,+ rollbackTitle: (v: string) => `Вернуться к стабильному релизу ${v}`,+ rollbackBody: (v: string) =>+ `Эта сборка новее стабильного релиза ${v}. Установка вернёт Hermes к этому релизу.`}diff --git a/apps/desktop/src/i18n/types_update_channel.ts b/apps/desktop/src/i18n/types_update_channel.tsindex fcca7d6dd0e..31dbc57ff49 100644--- a/apps/desktop/src/i18n/types_update_channel.ts+++ b/apps/desktop/src/i18n/types_update_channel.ts@@ -16,4 +16,8 @@ export interface UpdateChannelCopy {change: string/** Up to date on stable: names the release the install is pinned to. */latestRelease: (version: string) => string+ /** Updates overlay title: the stable release is older than this checkout (a rollback). */+ rollbackTitle: (version: string) => string+ /** Installing the older stable release moves the checkout back; says so plainly. */+ rollbackBody: (version: string) => string}diff --git a/apps/desktop/src/i18n/zh-hant_update_channel.ts b/apps/desktop/src/i18n/zh-hant_update_channel.tsindex 6cf9715a1cb..03496b56e7a 100644--- a/apps/desktop/src/i18n/zh-hant_update_channel.ts+++ b/apps/desktop/src/i18n/zh-hant_update_channel.ts@@ -11,5 +11,8 @@ export const zhHantUpdateChannel = {detailsLabel: '頻道',branch: (b: string) => `分支:${b}`,change: '變更',- latestRelease: (v: string) => `你正在使用最新的穩定版發布(${v})。`+ latestRelease: (v: string) => `你正在使用最新的穩定版發布(${v})。`,+ rollbackTitle: (v: string) => `回退到穩定版 ${v}`,+ rollbackBody: (v: string) =>+ `目前的組建比穩定版 ${v} 更新。安裝後 Hermes 將回退到該版本。`}diff --git a/apps/desktop/src/i18n/zh_update_channel.ts b/apps/desktop/src/i18n/zh_update_channel.tsindex b132a6a1d71..bd5982b2b5b 100644--- a/apps/desktop/src/i18n/zh_update_channel.ts+++ b/apps/desktop/src/i18n/zh_update_channel.ts@@ -11,5 +11,8 @@ export const zhUpdateChannel = {detailsLabel: '渠道',branch: (b: string) => `分支:${b}`,change: '更改',- latestRelease: (v: string) => `你正在使用最新的稳定版发布(${v})。`+ latestRelease: (v: string) => `你正在使用最新的稳定版发布(${v})。`,+ rollbackTitle: (v: string) => `回退到稳定版 ${v}`,+ rollbackBody: (v: string) =>+ `当前构建比稳定版 ${v} 更新。安装后 Hermes 将回退到该版本。`}diff --git a/apps/desktop/src/lib/update-copy.ts b/apps/desktop/src/lib/update-copy.tsindex e9d3a543df0..f74d22bdef4 100644--- a/apps/desktop/src/lib/update-copy.ts+++ b/apps/desktop/src/lib/update-copy.ts@@ -56,6 +56,21 @@ export interface UpdateCopyResult {body: string}+/** The release an update would move BACK to (the checkout already contains it), else null. */+export function rollbackRelease(status?: null | { rollback?: boolean; sourceVersion?: string }): null | string {+ return status?.rollback && status.sourceVersion ? `v${status.sourceVersion}` : null+}++/** The tooltip sentence for {@link rollbackRelease}, or undefined when the update moves forward. */+export function rollbackSentence(+ status: Parameters<typeof rollbackRelease>[0],+ sentence: (version: string) => string+): string | undefined {+ const tag = rollbackRelease(status)++ return tag ? sentence(tag) : undefined+}+export function resolveUpdateCopy({target,shownItems,diff --git a/apps/desktop/src/lib/version-status.ts b/apps/desktop/src/lib/version-status.tsindex d7028616629..33ddd9fdd18 100644--- a/apps/desktop/src/lib/version-status.ts+++ b/apps/desktop/src/lib/version-status.ts@@ -47,6 +47,8 @@ export interface VersionStatusInput {latestTag?: null | string/** Remote mode: the client is one of two versions on screen, so it says so. */remote: boolean+ /** Tooltip sentence for a move back to an older release; replaces the update line. */+ rollback?: string/** The apply reached the restart stage — labels `restart`, not `update`. */restarting: boolean/** Client only: short commit sha of the running build. */@@ -76,6 +78,7 @@ export function resolveVersionStatus({latestTag = null,remote,restarting,+ rollback,sha = null,target,updateAvailable,@@ -111,9 +114,10 @@ export function resolveVersionStatus({const tooltip = [busy && (applyMessage || copy.updateInProgress),- !busy && available && stable && latestTag && copy.releaseAvailable(latestTag),+ !busy && available && rollback,+ !busy && available && !rollback && stable && latestTag && copy.releaseAvailable(latestTag),!busy && !stable && behind > 0 && copy.commitsBehind(behind, (client ? branch : 'main') || '...'),- !busy && available && (stable ? !latestTag : behind <= 0) && copy.update,+ !busy && available && !rollback && (stable ? !latestTag : behind <= 0) && copy.update,version && (client ? copy.desktopVersion(version) : copy.backendVersion(version)),client && sha && copy.commit(sha),// The branch line is main-channel vocabulary; a stable checkout sits ondiff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.jsonindex 1f6b929f603..75900df88c5 100644--- a/locales/_keys.desktop.json+++ b/locales/_keys.desktop.json@@ -2544,6 +2544,8 @@"settings.about.channel.failed","settings.about.channel.latestRelease","settings.about.channel.main",+ "settings.about.channel.rollbackBody",+ "settings.about.channel.rollbackTitle","settings.about.channel.stable","settings.about.channel.stableConfirm","settings.about.channel.stableConfirmBody",