The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): close the Linux notification bus on will-quit
kshitijk4poor8f7b3b48fc61
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex 8eb0ba65442..213cd10586f 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -17237,7 +17237,7 @@ ipcMain.handle('hermes:api', async (_event, request) => {const ownsAmbientCue = createAmbientClaimArbiter()ipcMain.handle('hermes:ambient:claim', (_event, key) => ownsAmbientCue(String(key ?? '')))-registerNativeNotifications({ getMainWindow: () => mainWindow, focusWindow })+const nativeNotifications = registerNativeNotifications({ getMainWindow: () => mainWindow, focusWindow })// Data-URL file load cap (composer attach + local previews). Main owns the// persisted MB value so every IPC read honours Settings → Chat without the@@ -17630,6 +17630,7 @@ app.on('before-quit', () => {app.on('will-quit', () => {sshIsolatedKeepalives.stopAll()destroyKeepaliveAgents()+ nativeNotifications.dispose()quitFinalization.arm()})diff --git a/apps/desktop/electron/notification-ipc.ts b/apps/desktop/electron/notification-ipc.tsindex c39f883dff8..ae5ce080284 100644--- a/apps/desktop/electron/notification-ipc.ts+++ b/apps/desktop/electron/notification-ipc.ts@@ -16,7 +16,7 @@ export function registerNativeNotifications({getMainWindow,focusWindow,platform = process.platform-}: NotificationHost): void {+}: NotificationHost): { dispose: () => void } {const dedupeIntervalMs = 1000const isDuplicateNotification = createEventDeduper(dedupeIntervalMs)const deliveries = new Map<string, Promise<boolean>>()@@ -119,4 +119,6 @@ export function registerNativeNotifications({return delivery})++ return { dispose: () => linux?.dispose() }}diff --git a/apps/desktop/electron/notification-linux.test.ts b/apps/desktop/electron/notification-linux.test.tsindex 11b10d048cc..6ebdcb93d16 100644--- a/apps/desktop/electron/notification-linux.test.ts+++ b/apps/desktop/electron/notification-linux.test.ts@@ -135,7 +135,11 @@ function setup(alreadyRunning = false) {const source = { isDestroyed: vi.fn(() => false), webContents: { send: vi.fn() } }host.fromWebContents.mockReturnValue(source)const focusWindow = vi.fn()- registerNativeNotifications({ getMainWindow: () => primary as unknown as BrowserWindow, focusWindow, platform: 'linux' })+ const { dispose } = registerNativeNotifications({+ getMainWindow: () => primary as unknown as BrowserWindow,+ focusWindow,+ platform: 'linux'+ })const notify = (payload: HermesNotification) =>Promise.resolve(@@ -154,6 +158,7 @@ function setup(alreadyRunning = false) {return {connection,+ dispose,calls,primary,source,@@ -331,6 +336,11 @@ it(expect(reused.source.webContents.send).not.toHaveBeenCalled()reused.signal('ActionInvoked', [retainedId, 'default'])expect(reused.source.webContents.send).toHaveBeenCalledWith('hermes:focus-session', 'new-session')- reused.connection.emit('close')++ // Quit teardown closes the bus; a delivered notification's callbacks die with it.+ reused.dispose()+ expect(reused.connection.stream.destroy).toHaveBeenCalled()+ reused.signal('ActionInvoked', [retainedId, 'default'])+ expect(reused.source.webContents.send).toHaveBeenCalledTimes(1)})diff --git a/apps/desktop/electron/notification-linux.ts b/apps/desktop/electron/notification-linux.tsindex 9082ae5cfd7..fe8de2f4842 100644--- a/apps/desktop/electron/notification-linux.ts+++ b/apps/desktop/electron/notification-linux.ts@@ -317,5 +317,9 @@ export function createLinuxNotifications() {return Object.assign(notification, { show, close })}- return { create }+ // Quit teardown: the close event fails every live notification and drops the+ // connection, the same path a daemon crash takes.+ const dispose = () => connection?.bus.connection.stream.destroy()++ return { create, dispose }}