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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(quit): re-run the SSH mirror flush after the renderer flush answers
review258d0c5413f5
diff --git a/src/main/index.ts b/src/main/index.tsindex 142680015..317c1b234 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -5370,8 +5370,10 @@ app.on('before-quit', (e) => {// The renderer's debounced canvas save rides the same race (src/main/renderer-flush.ts, capped// at 1 s and never throwing): ⌘Q / tray Quit used to drop the last ~800 ms of canvas edits. A// restart-to-update flushes earlier, in the updater — on macOS its windows are gone by now.+ // The renderer's save can itself queue a throttled SSH mirror write AFTER the first remote+ // flush took its snapshot, so the remote flush runs again once the renderer answered.const flush = Promise.allSettled([- requestRendererFlush(getMainWindow()?.webContents, ipcMain),+ requestRendererFlush(getMainWindow()?.webContents, ipcMain).then(() => remoteWorkspaceIO.flush()),remoteWorkspaceIO.flush(),ptyManager.killAll(),watchLinksStoppeddiff --git a/src/main/renderer-flush.test.ts b/src/main/renderer-flush.test.tsindex 8b8501054..421333eba 100644--- a/src/main/renderer-flush.test.ts+++ b/src/main/renderer-flush.test.ts@@ -63,3 +63,16 @@ describe('requestRendererFlush', () => {expect(new Set(sentIds).size).toBe(2)})})++describe('before-quit wiring (source guard)', () => {+ it('re-runs the SSH mirror flush AFTER the renderer flush answered', async () => {+ const { readFileSync } = await import('fs')+ const { join } = await import('path')+ const src = readFileSync(join(__dirname, 'index.ts'), 'utf-8')+ // The renderer's save may queue a throttled mirror write after the parallel remote flush took+ // its snapshot; without the chained flush that write dies with the ControlMasters.+ expect(src).toMatch(+ /requestRendererFlush\(getMainWindow\(\)\?\.webContents, ipcMain\)\.then\(\(\) => remoteWorkspaceIO\.flush\(\)\)/+ )+ })+})