Skip to content

The agent that grows with you

fix(desktop): honour updates.pre_update_backup=off in the Desktop updater preflight again

ethernet37fd64401710
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index 98a2c218314..292a641b504 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -419,6 +419,7 @@ import {
resolveRemoteRequestHeaders
} from './remote-ws-headers'
import { missingRendererAssets } from './renderer-bundle'
+import { readPreUpdateBackupEnabled } from './pre-update-backup-config'
import { planLaunchSwitches, readDesktopLaunchConfig } from './renderer-heap-flags'
import { loadRendererLoadErrorPage } from './renderer-load-error-page'
import { attachRendererConsoleCapture, formatRendererBoundaryReport } from './renderer-log'
@@ -3328,6 +3329,21 @@ function resolveCheckoutUpdateStrategy(): UpdaterStrategy {
repairMacUpdaterHelper,
preflightStateDb: async (home: string, log: (message: string) => void): Promise<void> => {
const root: string = resolveUpdateRoot()
+
+ // `updates.pre_update_backup: off` is the CLI's opt-out for the whole
+ // pre-update backup family; the Desktop's emergency snapshot honours it
+ // too (4de06d1dbf7b). An unreadable answer keeps the snapshot.
+ if (
+ !(await readPreUpdateBackupEnabled(
+ resolveHermesBackend(['config', 'get', 'updates.pre_update_backup', '--json']),
+ home
+ ))
+ ) {
+ log('[updates] emergency state.db backup disabled by updates.pre_update_backup')
+
+ return
+ }
+
preflightStateDb({
python: await findPythonForRoot(root),
script: path.join(root, 'hermes_cli', 'backup_sqlite.py'),
diff --git a/apps/desktop/electron/pre-update-backup-config.ts b/apps/desktop/electron/pre-update-backup-config.ts
index 1f8b7401f6f..d4846ad7aaa 100644
--- a/apps/desktop/electron/pre-update-backup-config.ts
+++ b/apps/desktop/electron/pre-update-backup-config.ts
@@ -13,7 +13,7 @@ export function preUpdateBackupEnabled(value: unknown): boolean {
}
export interface HermesConfigRuntime {
- command?: string
+ command?: string | null
args?: string[]
env?: NodeJS.ProcessEnv
shell?: boolean