From bceb407b567b70e6b4992835ca28b5e9ebe0eaa2 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Mon, 10 Aug 2026 17:55:10 -0700 Subject: [PATCH] [eric] updates: first check reads the experimental toggle from disk, ending the prerelease self-downgrade ping-pong --- electron/main.js | 7 +++++++ .../pages/Settings/sections/general/SoftwareUpdateRow.tsx | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/electron/main.js b/electron/main.js index d7e592f1..75cc5930 100644 --- a/electron/main.js +++ b/electron/main.js @@ -1866,6 +1866,13 @@ function setupAutoUpdater() { autoUpdater.autoInstallOnAppQuit = true; // Renderer pushes the user's experimental-updates setting via IPC right after settings load. autoUpdater.allowPrerelease = false; + // The boot check below must not race that IPC push: with allowDowngrade on, a prerelease build checking while allowPrerelease is still false sees latest-stable as a valid target and silently self-downgrades, then upgrades again next boot (the 1.7.5 <-> 1.7.6-exp1 ping-pong). Read the toggle straight from disk so the first check already knows it. + try { + const onDisk = JSON.parse(fs.readFileSync(path.join(app.getPath('userData'), 'data', 'settings', 'settings.json'), 'utf8')); + autoUpdater.allowPrerelease = !!onDisk.allow_experimental_updates; + } catch (_) { + // Fresh install or unreadable settings: stays false, and a fresh install is never on a prerelease. + } // Lets us un-ship a bad release: re-flip GH 'latest' to an older one and users hop back to it. autoUpdater.allowDowngrade = true; } diff --git a/frontend/src/app/pages/Settings/sections/general/SoftwareUpdateRow.tsx b/frontend/src/app/pages/Settings/sections/general/SoftwareUpdateRow.tsx index 137ef9a6..8f7e86cd 100644 --- a/frontend/src/app/pages/Settings/sections/general/SoftwareUpdateRow.tsx +++ b/frontend/src/app/pages/Settings/sections/general/SoftwareUpdateRow.tsx @@ -103,9 +103,9 @@ const SoftwareUpdateRow: React.FC<{ styles: SettingsStyles }> = ({ styles }) => {updateStatus === 'checking' && 'Checking for updates…'} {updateStatus === 'not-available' && 'You\'re on the latest version.'} - {updateStatus === 'available' && `Version ${availableVersion} is available.`} + {updateStatus === 'available' && (availableVersion ? `Version ${availableVersion} is available.` : 'An update is available.')} {updateStatus === 'downloading' && `Downloading update… ${Math.round(downloadPercent)}%`} - {updateStatus === 'downloaded' && `Version ${availableVersion} is ready to install.`} + {updateStatus === 'downloaded' && (availableVersion ? `Version ${availableVersion} is ready to install.` : 'An update is ready to install.')} {updateStatus === 'error' && (updateError || 'Update check failed.')} {updateStatus === 'idle' && 'Check for new versions of OpenSwarm.'}