Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: OMNIRUSH_AUTO_UPDATE=0 turns the desktop updater off

ogsamrat89515be0116f
diff --git a/apps/desktop/electron/main.mjs b/apps/desktop/electron/main.mjs
index 5d7dab44..b7e10420 100644
--- a/apps/desktop/electron/main.mjs
+++ b/apps/desktop/electron/main.mjs
@@ -23,7 +23,7 @@ import { configureFakeMediaForTests, installMediaPermissionHandlers } from "./me
import { registerMigrationIpc } from "./migration.mjs";
import { createRuntimeManager, createSystemCaCertificateVerifyProc } from "./runtime.mjs";
import { installAppRequestSecret } from "./app-request-secret.mjs";
-import { registerUpdaterIpc } from "./updater.mjs";
+import { registerUpdaterIpc, updatesTurnedOff } from "./updater.mjs";
import { initialWindowSize } from "./window-size.mjs";
import {
browserActApproval,
@@ -2686,9 +2686,12 @@ const desktopCommandHandlers = {
},
"updaterEnvironment": async (event, ...args) => {
const executablePath = app.isPackaged ? app.getPath("exe") : process.execPath;
+ const turnedOff = updatesTurnedOff();
return {
- supported: app.isPackaged,
- reason: app.isPackaged ? null : "Updates are unavailable in development builds.",
+ supported: app.isPackaged && !turnedOff,
+ reason: !app.isPackaged
+ ? "Updates are unavailable in development builds."
+ : turnedOff ? "Updates are turned off (OMNIRUSH_AUTO_UPDATE=0)." : null,
executablePath,
appBundlePath:
process.platform === "darwin"
diff --git a/apps/desktop/electron/updater.mjs b/apps/desktop/electron/updater.mjs
index 6cf82ab0..3d9a71b1 100644
--- a/apps/desktop/electron/updater.mjs
+++ b/apps/desktop/electron/updater.mjs
@@ -495,6 +495,11 @@ async function fileMatchesSha512(filePath, expected) {
});
}
+// OMNIRUSH_AUTO_UPDATE=0 (as in the CLI) turns the updater off: no check, download or install, quit included.
+export function updatesTurnedOff(env = process.env) {
+ return env.OMNIRUSH_AUTO_UPDATE === "0";
+}
+
// electron-updater wiring. Packaged-only; dev builds skip this so the
// updater doesn't try to probe a non-existent release channel.
export function preventPendingUpdaterInstall(updater) {
@@ -855,7 +860,7 @@ export function registerUpdaterIpc({
}
async function ensureAutoUpdater() {
- if (!app.isPackaged) return null;
+ if (!app.isPackaged || updatesTurnedOff(env)) return null;
if (!autoUpdaterLoadPromise) {
autoUpdaterLoadPromise = (async () => {
try {
@@ -1115,6 +1120,7 @@ export function registerUpdaterIpc({
const id = stableVersion(rawId);
const release = id ? recoveryReleases.find((candidate) => candidate.id === id) : null;
if (!release) return { ok: false, reason: "That recovery version is no longer available. Retry the release list." };
+ if (updatesTurnedOff(env)) return { ok: false, reason: "Updates are turned off (OMNIRUSH_AUTO_UPDATE=0)." };
if (release.eval) {
if (env.OMNIRUSH_EVAL_RECOVERY_CANDIDATES) {
recoveryWitness.installRequests.push({ version: release.version, artifactUrl: release.artifact.url });
diff --git a/apps/desktop/electron/updater.test.mjs b/apps/desktop/electron/updater.test.mjs
index 1f033f89..59ab2de4 100644
--- a/apps/desktop/electron/updater.test.mjs
+++ b/apps/desktop/electron/updater.test.mjs
@@ -653,6 +653,27 @@ describe("downloaded update lifecycle", () => {
});
});
+describe("OMNIRUSH_AUTO_UPDATE=0", () => {
+ it("never checks, downloads or installs, quit included", async () => {
+ let loaded = false;
+ const { tempDir, handlers, calls, prepareInstallOnQuit } = await registerFakeUpdaterIpc({
+ version: "0.17.1",
+ env: { OMNIRUSH_AUTO_UPDATE: "0" },
+ loadAutoUpdater: async () => { loaded = true; throw new Error("must not load"); },
+ });
+ try {
+ assert.equal((await handlers.get("omnirush:updater:check")(null, "stable")).available, false);
+ assert.deepEqual(await handlers.get("omnirush:updater:download")(), { ok: false, reason: "unavailable" });
+ assert.equal((await handlers.get("omnirush:updater:installAndRestart")()).ok, false);
+ assert.equal(await prepareInstallOnQuit(), null);
+ assert.equal(loaded, false);
+ assert.deepEqual(calls, []);
+ } finally {
+ await rm(tempDir, { recursive: true, force: true });
+ }
+ });
+});
+
describe("macOS code signature detection", () => {
it("derives the bundle path from the running executable", () => {
assert.equal(