Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(updater): actually install on "Restart to update" (was just hiding the window)

enescec2ada98dba
diff --git a/src/main/index.ts b/src/main/index.ts
index dd1f72842..82cfd8558 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -426,7 +426,11 @@ app.whenReady().then(async () => {
})
const win = createWindow()
- initUpdater(win)
+ // Flip `quitting` before quitAndInstall so the window's close-event actually closes (not hides);
+ // quitAndInstall closes all windows then calls app.quit(), which our hide-on-close would block.
+ initUpdater(win, () => {
+ quitting = true
+ })
// Mirror live agent status to <userData>/agent-status.json for the external mobile host agent.
initAgentStatusMirror()
diff --git a/src/main/updater.ts b/src/main/updater.ts
index ba67632a7..cf439b1dd 100644
--- a/src/main/updater.ts
+++ b/src/main/updater.ts
@@ -13,14 +13,23 @@ const { autoUpdater } = electronUpdater
const SIX_HOURS = 6 * 60 * 60 * 1000
-export function initUpdater(win: BrowserWindow): void {
+/**
+ * @param onBeforeRestart Run right before `quitAndInstall()`. Required so the caller can flip its
+ * "quitting" flag: `quitAndInstall()` closes all windows and only then calls `app.quit()`, but
+ * our `win.on('close')` hides the window (keeps the app alive) unless we're already quitting — so
+ * without this the window just hides, `app.quit()` never fires, and the update never installs.
+ */
+export function initUpdater(win: BrowserWindow, onBeforeRestart?: () => void): void {
const send = (channel: string, payload?: unknown) => {
if (!win.isDestroyed()) win.webContents.send(channel, payload)
}
// Always available, even in dev: current version, manual check, restart.
ipcMain.handle(IPC.appGetVersion, () => app.getVersion())
- ipcMain.on(IPC.appRestartToUpdate, () => autoUpdater.quitAndInstall())
+ ipcMain.on(IPC.appRestartToUpdate, () => {
+ onBeforeRestart?.()
+ autoUpdater.quitAndInstall()
+ })
if (!app.isPackaged) {
// Dev: there is no update server. A manual check reports "up to date" so the Settings