Skip to content

The agent that grows with you

fix(update): --version, the dashboard and a remote backend name a stable rollback too (#137714)

Tekniume36fa7ba6b13
diff --git a/apps/desktop/src/app/command-palette/index.tsx b/apps/desktop/src/app/command-palette/index.tsx
index 2b41cb971b5..235394bb5e7 100644
--- a/apps/desktop/src/app/command-palette/index.tsx
+++ b/apps/desktop/src/app/command-palette/index.tsx
@@ -611,7 +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),
+ rollback: 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.tsx
index 2e77e59a5b8..095e8c58e0a 100644
--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
@@ -447,6 +447,10 @@ export function useStatusbarItems({
copy,
remote: true,
restarting: backendUpdateApply.stage === 'restart',
+ rollback: rollbackSentence(
+ { rollback: backendUpdateStatus?.rollback, sourceVersion: backendUpdateStatus?.sourceVersion },
+ t.settings.about.channel.rollbackBody
+ ),
target: 'backend',
updateAvailable: backendUpdateStatus?.updateAvailable,
version: statusSnapshot?.version
@@ -468,6 +472,9 @@ export function useStatusbarItems({
connection?.mode,
statusSnapshot?.version,
backendUpdateStatus?.behind,
+ backendUpdateStatus?.rollback,
+ backendUpdateStatus?.sourceVersion,
+ t.settings.about.channel.rollbackBody,
backendUpdateStatus?.updateAvailable,
backendUpdateApply.applying,
backendUpdateApply.message,
diff --git a/apps/desktop/src/app/updates-overlay.tsx b/apps/desktop/src/app/updates-overlay.tsx
index bab4f7f238a..8567af69a46 100644
--- a/apps/desktop/src/app/updates-overlay.tsx
+++ b/apps/desktop/src/app/updates-overlay.tsx
@@ -308,7 +308,7 @@ function IdleView({
// instead of generic filler. On a release-feed channel (stable), name the
// release tag instead of commit vocabulary.
// A stable release this checkout already contains is a move back, never "a new update".
- const rollbackTag = target === 'client' ? rollbackRelease(status) : null
+ const rollbackTag = rollbackRelease(status)
const channelCopy = t.settings.about.channel
const { title, body } = rollbackTag
diff --git a/apps/desktop/src/components/update-status.tsx b/apps/desktop/src/components/update-status.tsx
index bce515e0714..677f8e93b84 100644
--- a/apps/desktop/src/components/update-status.tsx
+++ b/apps/desktop/src/components/update-status.tsx
@@ -123,7 +123,7 @@ function ordinaryUpdateStatus({
}
if (updateAvailable) {
- const back = target === 'client' && rollback ? rollbackRelease(status) : null
+ const back = rollback ? rollbackRelease(status) : null
return {
applying,
diff --git a/apps/desktop/src/store/updates.ts b/apps/desktop/src/store/updates.ts
index 563b5f0ffdd..9ce2014e8b4 100644
--- a/apps/desktop/src/store/updates.ts
+++ b/apps/desktop/src/store/updates.ts
@@ -514,6 +514,8 @@ export function mapBackendCheck(res: BackendUpdateCheckResponse): DesktopUpdateS
error: checkFailed ? 'check-failed' : undefined,
message: res.message ?? undefined,
updateAvailable: res.update_available,
+ rollback: res.rollback,
+ sourceVersion: res.source_version ?? undefined,
behind: behind === null || behind < 0 ? null : behind,
currentVersion: res.current_version,
targetSha: res.update_available ? `backend:${res.current_version}` : undefined,
diff --git a/apps/desktop/src/types/hermes.ts b/apps/desktop/src/types/hermes.ts
index b41f8f929d5..a0fe2caf10a 100644
--- a/apps/desktop/src/types/hermes.ts
+++ b/apps/desktop/src/types/hermes.ts
@@ -1596,6 +1596,9 @@ export interface BackendUpdateCheckResponse {
current_version: string
behind: number | null
update_available: boolean
+ /** A stable release this build already contains: applying it moves back. */
+ rollback?: boolean
+ source_version?: null | string
can_apply: boolean
update_command: string | null
message: string | null
diff --git a/hermes_cli/_startup_fast.py b/hermes_cli/_startup_fast.py
index c79e72404e7..fe780f6190d 100644
--- a/hermes_cli/_startup_fast.py
+++ b/hermes_cli/_startup_fast.py
@@ -225,8 +225,12 @@ def print_fast_version_info(*, check_updates: bool = True) -> None:
from hermes_cli.source_check import UPDATE_AVAILABLE_NO_COUNT, check_for_updates
from hermes_cli.config import recommended_update_command
- behind = check_for_updates(passive=True).get("behind")
- if behind == UPDATE_AVAILABLE_NO_COUNT:
+ status = check_for_updates(passive=True)
+ behind = status.get("behind")
+ if status.get("rollback"):
+ print(f"Newer than stable release v{status.get('sourceVersion')} — "
+ f"'{recommended_update_command()}' moves back to it")
+ elif behind == UPDATE_AVAILABLE_NO_COUNT:
print(f"Update available — run '{recommended_update_command()}'")
elif behind and behind > 0:
commits_word = "commit" if behind == 1 else "commits"
diff --git a/hermes_cli/web_routers/actions.py b/hermes_cli/web_routers/actions.py
index 879d1a09801..a702a4a329e 100644
--- a/hermes_cli/web_routers/actions.py
+++ b/hermes_cli/web_routers/actions.py
@@ -340,6 +340,11 @@ async def check_hermes_update(force: bool = False, profile: Optional[str] = None
payload["message"] = "You're on the latest version."
else:
payload["update_available"] = True
+ if status.get("rollback"):
+ # A stable release this build already contains: applying it moves back.
+ payload.update(rollback=True, source_version=status.get("sourceVersion"),
+ message=f"This build is newer than stable release v{status.get('sourceVersion')}. "
+ "Updating moves it back to that release.")
# "What's changed" for the desktop's remote update overlay; best-effort
# (empty list on any failure).
payload["commits"] = [{**row, "sha": row["sha"][:7], "at": row["at"] // 1000}
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index 2f16f42b1b8..1e97d13b659 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -922,8 +922,7 @@ function Stage-Repository {
# Only an explicit -Commit pin outranks the choice.
if (-not $Commit) { $channel = Get-ChosenChannel }
if ($channel -ceq 'main') { $channel = '' }
- if ($channel) { Log "Repairing $InstallDir on the $channel update channel it chose" }
- else { Log "Updating $InstallDir ($Branch)" }
+ if ($channel) { Log "Repairing $InstallDir on the $channel update channel it chose" } else { Log "Updating $InstallDir ($Branch)" }
# A checkout cloned before longpaths was set: a deep path past MAX_PATH fails checkout.
Invoke-Native { git -C $InstallDir config core.longpaths true } | Out-Null
# An explicit HERMES_REPO_URL names the source for reruns too, not
diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts
index 1197d315e32..2c7ef2d84a5 100644
--- a/web/src/lib/api.ts
+++ b/web/src/lib/api.ts
@@ -1910,6 +1910,9 @@ export interface UpdateCheckResponse {
// count (nix/pypi), or null when the check could not run.
behind: number | null;
update_available: boolean;
+ /** A stable release this build already contains: applying it moves back. */
+ rollback?: boolean;
+ source_version?: string | null;
can_apply: boolean;
update_command: string;
message: string | null;
diff --git a/web/src/pages/SystemPage.tsx b/web/src/pages/SystemPage.tsx
index dc0bcb01f2f..b11d463bf9f 100644
--- a/web/src/pages/SystemPage.tsx
+++ b/web/src/pages/SystemPage.tsx
@@ -583,7 +583,9 @@ export default function SystemPage() {
const info = await api.checkHermesUpdate(force);
setUpdateInfo(info);
if (force) {
- if (info.update_available) {
+ if (info.update_available && info.rollback && info.message) {
+ showToast(info.message, "success");
+ } else if (info.update_available) {
showToast(
info.behind && info.behind > 0
? `Update available — ${info.behind} commit${info.behind === 1 ? "" : "s"} behind`
@@ -930,9 +932,11 @@ export default function SystemPage() {
updateInfo &&
(updateInfo.update_available ? (
<Badge tone="warning">
- {updateInfo.behind && updateInfo.behind > 0
- ? `${updateInfo.behind} behind`
- : "update available"}
+ {updateInfo.rollback
+ ? `newer than v${updateInfo.source_version}`
+ : updateInfo.behind && updateInfo.behind > 0
+ ? `${updateInfo.behind} behind`
+ : "update available"}
</Badge>
) : updateInfo.behind === 0 ? (
<Badge tone="success">latest</Badge>