From 742e1652b8ce88d75322d68481511a5c02df92fd Mon Sep 17 00:00:00 2001 From: PabloWiedemann Date: Mon, 16 Nov 2026 12:28:05 -0800 Subject: [PATCH 1/3] fix(windows): Open after a copy or update starts the build in its own window Open on a finished operation (the new copy after Copy, a build after Update) called open-install-window. For a build that was not running it opened an empty Desktop window that stayed behind, and from a build window it never started the build. open-install-window now goes through the same openBuild router as the picker (Comfy-Org/Comfy-Desktop#2147): a running build comes to the front, and any other build starts from the window that asked, or from the home window when a build window asked, then opens in its own window. This is the part of Comfy-Org/Comfy-Desktop#2027 that #2147 did not cover. --- src/main/index.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 6281074df..67c312264 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -800,18 +800,6 @@ ipcMain.handle('focus-comfy-window', async (_event, installationId: string) => { return false }) -ipcMain.handle('open-install-window', (_event, installationId: string) => { - recordIpcInvocation('open-install-window', { installationId }) - const existing = getEntryByInstallationId(installationId) - if (existing && !existing.window.isDestroyed()) { - existing.window.show() - existing.window.focus() - return true - } - openChooserHostWindow() - return true -}) - ipcMain.handle( 'close-comfy-window', (_event, installationId: string, opts?: { skipConfirm?: boolean }) => { @@ -1118,6 +1106,20 @@ if (app.isPackaged && !app.requestSingleInstanceLock()) { } } + ipcMain.handle('open-install-window', async (event, installationId: unknown) => { + if (typeof installationId !== 'string') return false + recordIpcInvocation('open-install-window', { installationId }) + const requester = [...comfyWindows.values()].find( + (entry) => entry.panelView?.webContents === event.sender + ) + if (!requester) { + openOrFocusHomeHostWindow() + return true + } + await openBuild(installationId, requester.windowKey) + return true + }) + registerTitlePopupIpc({ openChooserHostWindow, returnToDashboard, From f0ab1abae88d92d045f8ce10b8ae3815b9be9109 Mon Sep 17 00:00:00 2001 From: PabloWiedemann Date: Mon, 16 Nov 2026 13:59:42 -0800 Subject: [PATCH 2/3] fix(windows): route open-install-window from any sender through openBuild --- src/main/index.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 67c312264..6a07fc72e 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1112,11 +1112,7 @@ if (app.isPackaged && !app.requestSingleInstanceLock()) { const requester = [...comfyWindows.values()].find( (entry) => entry.panelView?.webContents === event.sender ) - if (!requester) { - openOrFocusHomeHostWindow() - return true - } - await openBuild(installationId, requester.windowKey) + await openBuild(installationId, requester?.windowKey ?? -1) return true }) From 7dcba670c22014c5d02085afedf879669a928200 Mon Sep 17 00:00:00 2001 From: PabloWiedemann Date: Mon, 16 Nov 2026 15:24:32 -0800 Subject: [PATCH 3/3] fix(windows): refuse unknown senders on open-install-window and start a copy the panel has not loaded yet --- src/main/index.ts | 14 +++++++++---- .../src/composables/useDeepLinkRouter.ts | 6 +++++- src/renderer/src/panel/PanelApp.test.ts | 21 +++++++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 6a07fc72e..704dfe53d 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1107,13 +1107,19 @@ if (app.isPackaged && !app.requestSingleInstanceLock()) { } ipcMain.handle('open-install-window', async (event, installationId: unknown) => { - if (typeof installationId !== 'string') return false + if (typeof installationId !== 'string' || installationId === '') return false recordIpcInvocation('open-install-window', { installationId }) const requester = [...comfyWindows.values()].find( - (entry) => entry.panelView?.webContents === event.sender + (entry) => !entry.window.isDestroyed() && entry.panelView?.webContents === event.sender ) - await openBuild(installationId, requester?.windowKey ?? -1) - return true + if (!requester) return false + try { + await openBuild(installationId, requester.windowKey) + return true + } catch (error) { + console.error('open-install-window: could not open the build', { installationId, error }) + return false + } }) registerTitlePopupIpc({ diff --git a/src/renderer/src/composables/useDeepLinkRouter.ts b/src/renderer/src/composables/useDeepLinkRouter.ts index 8f617ad7c..f040bfe67 100644 --- a/src/renderer/src/composables/useDeepLinkRouter.ts +++ b/src/renderer/src/composables/useDeepLinkRouter.ts @@ -80,7 +80,11 @@ export function useDeepLinkRouter(opts: DeepLinkRouterOpts): void { await opts.bootstrapReady const id = payload.installationId if (!id) return - const inst = installationStore.getById(id) + const inst = + installationStore.getById(id) ?? + (await installationStore.fetchInstallations().catch(() => [])).find( + (installation) => installation.id === id + ) if (!inst) { if (payload.startupRestore) { window.api.resolveStartupRestoreReveal('dashboard-fallback') diff --git a/src/renderer/src/panel/PanelApp.test.ts b/src/renderer/src/panel/PanelApp.test.ts index 416073e9b..96d4bacb3 100644 --- a/src/renderer/src/panel/PanelApp.test.ts +++ b/src/renderer/src/panel/PanelApp.test.ts @@ -1320,6 +1320,27 @@ describe('PanelApp', () => { expect(api.resolveStartupRestoreReveal).toHaveBeenCalledWith('takeover-ready') }) + it('starts a picked build that this window has not loaded yet, such as a copy made a moment ago', async () => { + mockState.installations = [] + const api = (window as unknown as { api: Record> }).api + api.getListActions.mockResolvedValue([ + { id: 'launch', label: 'Start', style: 'primary', showProgress: true } + ]) + api.runAction.mockReturnValueOnce(new Promise(() => {})) + Object.assign(api, { onInstallProgress: vi.fn(() => () => {}) }) + window.history.replaceState({}, '', '/?panel=chooser&firstUseCompleted=true') + mountPanel() + await flushPromises() + + mockState.installations = [SAMPLE_INSTALL] + mockState.panelTriggerOverlayCallbacks.forEach((cb) => + cb({ kind: 'picker-pick-install', installationId: 'test-id' }) + ) + await flushPromises() + + expect(api.runAction).toHaveBeenCalledWith('test-id', 'launch') + }) + it('Start on a Home build card starts it there and leaves this window on Home', async () => { mockState.installations = [SAMPLE_INSTALL] const api = (window as unknown as { api: Record> }).api