Skip to content

The agent that grows with you

fix(desktop): Change only where Settings can switch; name the release only on an explicit not-ahead

Teknium26fa3aa07952
diff --git a/apps/desktop/src/app/updates-overlay.channel.test.tsx b/apps/desktop/src/app/updates-overlay.channel.test.tsx
new file mode 100644
index 00000000000..4218f4ff691
--- /dev/null
+++ b/apps/desktop/src/app/updates-overlay.channel.test.tsx
@@ -0,0 +1,46 @@
+import { act, cleanup, render, screen } from '@testing-library/react'
+import { afterEach, expect, it } from 'vitest'
+
+import type { DesktopUpdateStatus } from '@/global'
+import { I18nProvider } from '@/i18n/context'
+import { $desktopVersion, $updateOverlayOpen, $updateOverlayTarget, $updateStatus } from '@/store/updates'
+
+import { UpdatesOverlay } from './updates-overlay'
+
+afterEach((): void => {
+ cleanup()
+ $updateOverlayOpen.set(false)
+ $updateStatus.set(null)
+ $desktopVersion.set(null)
+})
+
+async function openWith(status: DesktopUpdateStatus): Promise<void> {
+ $desktopVersion.set({ appVersion: '0.21.6', electronVersion: '37', hermesRoot: '/h', nodeVersion: '22', platform: 'linux' })
+ $updateStatus.set({ supported: true, behind: 0, mechanism: 'posix-handoff', ...status })
+ $updateOverlayTarget.set('client')
+ $updateOverlayOpen.set(true)
+ await act(async (): Promise<void> => {
+ render(
+ <I18nProvider configClient={null} initialLocale="en">
+ <UpdatesOverlay />
+ </I18nProvider>
+ )
+ })
+}
+
+it('offers Change only where Settings can switch; a custom branch or older runtime gets the label alone', async () => {
+ await openWith({ channel: 'stable', channelSelectable: true })
+ expect(screen.getByText('Channel')).toBeTruthy()
+ expect(screen.getByRole('button', { name: 'Change' })).toBeTruthy()
+ cleanup()
+
+ await openWith({ branch: 'feature/gui', channelSelectable: true })
+ expect(screen.getByText(/Branch: feature\/gui/)).toBeTruthy()
+ expect(screen.queryByRole('button', { name: 'Change' })).toBeNull()
+ cleanup()
+
+ // An older runtime cannot save a channel, so Settings shows no selector to land on.
+ await openWith({ channel: 'stable' })
+ expect(screen.getByText('Stable releases')).toBeTruthy()
+ expect(screen.queryByRole('button', { name: 'Change' })).toBeNull()
+})
diff --git a/apps/desktop/src/app/updates-overlay.tsx b/apps/desktop/src/app/updates-overlay.tsx
index 2c6b563f2b1..1dd78e9c4c2 100644
--- a/apps/desktop/src/app/updates-overlay.tsx
+++ b/apps/desktop/src/app/updates-overlay.tsx
@@ -49,6 +49,7 @@ import {
dismissDiscontinuedNotice,
resetUpdateApplyState,
setUpdateOverlayOpen,
+ sourceUpdateChannel,
type UpdateApplyState
} from '@/store/updates'
@@ -236,7 +237,10 @@ function IdleView({
</button>
)
- const details = version ? <VersionDetails channelAction={changeChannel} version={version} /> : null
+ // Only where Settings shows a selector: a custom branch or an older runtime gets the label alone.
+ const details = version ? (
+ <VersionDetails channelAction={sourceUpdateChannel(status) ? changeChannel : undefined} version={version} />
+ ) : null
// App-installer check-unknown (OS checker unavailable): NOT "no updates"
// and NOT a generic error — the OS also installs updates automatically on
diff --git a/apps/desktop/src/components/update-status.test.tsx b/apps/desktop/src/components/update-status.test.tsx
index b3ed6fc89a5..dd0f3235c3b 100644
--- a/apps/desktop/src/components/update-status.test.tsx
+++ b/apps/desktop/src/components/update-status.test.tsx
@@ -45,7 +45,7 @@ function derive(status: DesktopUpdateStatus | null, apply: UpdateApplyState = ID
describe('deriveUpdateStatus', () => {
it('names the stable release only when the checkout is on it', () => {
const latestRelease = en.settings.about.channel.latestRelease
- const stable = { supported: true, behind: 0, channel: 'stable', sourceVersion: '0.21.6', targetSha: 'a'.repeat(40) }
+ const stable = { supported: true, behind: 0, channel: 'stable', sourceVersion: '0.21.6', targetSha: 'a'.repeat(40), aheadOfRelease: false }
const on = deriveUpdateStatus({ apply: IDLE_APPLY, checking: false, latestRelease, status: { ...stable, currentSha: 'a'.repeat(40) }, target: 'client', u: en.updates })
expect(on.line).toBe('You’re on the latest stable release (v0.21.6).')
@@ -61,6 +61,18 @@ describe('deriveUpdateStatus', () => {
})
expect(ahead.line).toBe(en.updates.latestBody)
+
+ // An older checker omits the field and may also pin an ahead checkout to HEAD: never name the release.
+ const older = deriveUpdateStatus({
+ apply: IDLE_APPLY,
+ checking: false,
+ latestRelease,
+ status: { ...stable, currentSha: 'a'.repeat(40), aheadOfRelease: undefined },
+ target: 'client',
+ u: en.updates
+ })
+
+ expect(older.line).toBe(en.updates.latestBody)
expect(derive({ supported: true, behind: 0, branch: 'main' }).line).toBe(en.updates.latestBody)
})
diff --git a/apps/desktop/src/components/update-status.tsx b/apps/desktop/src/components/update-status.tsx
index 4207bc6d5ff..e92d302c2e7 100644
--- a/apps/desktop/src/components/update-status.tsx
+++ b/apps/desktop/src/components/update-status.tsx
@@ -129,7 +129,8 @@ function ordinaryUpdateStatus({ apply, checking, latestRelease, status, target,
latestRelease &&
status.channel === 'stable' &&
status.sourceVersion &&
- !status.aheadOfRelease &&
+ // Older checkers omit the field and may also pin an ahead checkout to HEAD.
+ status.aheadOfRelease === false &&
status.targetSha &&
status.currentSha === status.targetSha
diff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.ts
index faf6ee18450..efefcb75ea6 100644
--- a/apps/desktop/src/global.d.ts
+++ b/apps/desktop/src/global.d.ts
@@ -887,7 +887,7 @@ export interface DesktopUpdateStatus {
latestTag?: string | null
/** Source stable: the release version the channel resolves to, e.g. `0.21.6`. */
sourceVersion?: string
- /** Source stable, forward-only: this checkout is newer than that release and waits for the next. */
+ /** Source stable: true when forward-only (newer than the release); absent from older checkers. */
aheadOfRelease?: boolean
targetSha?: string
commits?: DesktopUpdateCommit[]
diff --git a/hermes_cli/source_check.py b/hermes_cli/source_check.py
index 279ba23fa82..67d265f76ad 100644
--- a/hermes_cli/source_check.py
+++ b/hermes_cli/source_check.py
@@ -290,9 +290,9 @@ def _resolve_channel(result: dict, channel: str, co: _Checkout, *, forward_only:
result.update(channel=channel, targetSha=target, updateAvailable=co.head != target,
behind=0 if co.head == target else UPDATE_AVAILABLE_NO_COUNT,
sourceVersion=source_target.version, buildId=source_target.build_id)
- if getattr(source_target, "ahead", False):
- # Forward-only: the target is this checkout's own HEAD, newer than the release.
- result["aheadOfRelease"] = True
+ # Forward-only pins the target to this checkout's own HEAD, newer than the release.
+ # Always present: Desktop names the release only on an explicit False.
+ result["aheadOfRelease"] = bool(getattr(source_target, "ahead", False))
if source_target.retired:
result["retirement"] = {"destination": source_target.channel, "sourceOnly": True}
return source_target