The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): run last-surface quit fallback when the last Browser pop-out closes
kshitijk4poor67d502a1d458
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex f9b87e105c4..62559f9e12b 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -13969,7 +13969,12 @@ function spawnBrowserWindow(tabId) {})minimizeToTray.registerWindow(win)- win.on('closed', () => notifyBrowserPopoutClosed(tabId))+ win.on('closed', () => {+ notifyBrowserPopoutClosed(tabId)+ // Deferred: browserWindows' own self-delete 'closed' listener is attached+ // after this factory returns, so the size is only accurate next tick.+ setImmediate(quitIfNoSurfaceLeft)+ })loadWindowUrl(win,@@ -19683,23 +19688,26 @@ function registerChatWindow(window: BrowserWindow) {})window.once('closed', () => {chatWindows.delete(window)-- // See shouldQuitOnLastChatClosed (#130810).- // Popped-out Browser windows (browserWindows registry) are user-visible- // surfaces too, so they keep the app alive.- if (- shouldQuitOnLastChatClosed({- platform: process.platform,- isQuittingForHandoff,- remainingChatWindows: chatWindows.size + browserWindows.size,- quitInProgress- })- ) {- app.quit()- }+ quitIfNoSurfaceLeft()})}+// Last-surface fallback (#130810), run when a chat window OR a popped-out+// Browser window closes: popped-out Browser windows are user-visible surfaces+// too, so they keep the app alive — and closing the last one must quit.+function quitIfNoSurfaceLeft() {+ if (+ shouldQuitOnLastChatClosed({+ platform: process.platform,+ isQuittingForHandoff,+ remainingChatWindows: chatWindows.size + browserWindows.size,+ quitInProgress+ })+ ) {+ app.quit()+ }+}+app.on('before-quit', event => {// Runs ahead of every teardown below, so "Keep Running" leaves the app// exactly as it was: a held quit is not a quit in progress, and the