Repository navigation
fix(windows): Open after a copy or update starts the build in its own window - #2158
PabloWiedemann wants to merge 2 commits into
Conversation
… 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 (#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 #2027 that #2147 did not cover.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @PabloWiedemann.
Found 8 finding(s).
| Severity | Count |
|---|---|
| 🟡 Medium | 3 |
| 🟢 Low | 5 |
Panel: 8/8 reviewers contributed findings.
| 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( |
There was a problem hiding this comment.
🟡 Medium — Unlike sibling handlers in this file (close-host-window, return-to-dashboard, transfer-host-bounds-to-install), this one does not reject an unrecognized sender: when event.sender is not a registered panel view, the lookup falls through to the -1 sentinel and openBuild treats the call as having no requester, routing to start-from-home and opening/focusing Home for an arbitrary build. Return false for unmatched senders instead of granting the more privileged no-requester path. Raised by 3 of 8 reviewers (claude-opus-5-thinking-max adversarial, kimi-k2.7-code adversarial, gemini-3.1-pro edge-case).
| const requester = [...comfyWindows.values()].find( | ||
| (entry) => entry.panelView?.webContents === event.sender | ||
| ) | ||
| await openBuild(installationId, requester?.windowKey ?? -1) |
There was a problem hiding this comment.
🟡 Medium — await openBuild(...) is unguarded, and its start-from-home branch awaits getInstallation(), which reads and parses installations.json and can reject; the rejection now crosses ipcMain.handle back to the renderer with the main-process message and stack. Both call sites (ProgressModal.vue handleDone, PanelApp.vue handleProgressSuccessChoice) use void window.api.openInstallWindow(...) with no .catch, so it becomes an unhandled rejection with no user feedback; wrap in try/catch and return false. Raised by 3 of 8 reviewers (claude-opus-5-thinking-max edge-case, claude-opus-5-thinking-max adversarial, kimi-k2.7-code edge-case).
| const requester = [...comfyWindows.values()].find( | ||
| (entry) => entry.panelView?.webContents === event.sender | ||
| ) | ||
| await openBuild(installationId, requester?.windowKey ?? -1) |
There was a problem hiding this comment.
🟡 Medium — Routing through openBuild replaces "show/focus a window" with delivering a picker-pick-install message, and useDeepLinkRouter silently returns when installationStore.getById(id) misses. After a copy/convert, ProgressModal fires openInstallWindow(newInstallationId) immediately and races the renderer's installations-changed store refresh, so a brand-new id can be dropped and no window opens — the old handler at least fell back to openChooserHostWindow(). Raised by 2 of 8 reviewers (claude-opus-5-thinking-max edge-case, gpt-5.6-sol-max edge-case).
| (entry) => entry.panelView?.webContents === event.sender | ||
| ) | ||
| await openBuild(installationId, requester?.windowKey ?? -1) | ||
| return true |
There was a problem hiding this comment.
🟢 Low — return true is unconditional even though openBuild has several no-op paths: the ignore route (requester already hosts that build) and the start-from-home bailouts that only console.error for an unknown installation or a window missing from the registry. The declared openInstallWindow(id): Promise<boolean> contract therefore reports success for requests that did nothing, leaving callers unable to fall back. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max edge-case, claude-opus-5-thinking-max adversarial).
| 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( |
There was a problem hiding this comment.
🟢 Low — The requester lookup does not skip entries whose window is already destroyed, unlike the sibling handlers. A destroyed-but-still-registered entry hosting the same build yields the ignore route and silently drops the request; add an !entry.window.isDestroyed() guard to the find predicate. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max edge-case, kimi-k2.7-code edge-case).
| } | ||
|
|
||
| ipcMain.handle('open-install-window', async (event, installationId: unknown) => { | ||
| if (typeof installationId !== 'string') return false |
There was a problem hiding this comment.
🟢 Low — The guard checks the type but not emptiness or shape, so '' passes through to openBuild(''), which finds no hosting window and delivers a picker-pick-install for a nonexistent id while still returning true. Unbounded strings also flow into recordBuildOpen telemetry (to_installation_id) and the openBuild: unknown installation log line; validating against the expected inst-<ts> shape closes both. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max edge-case, claude-opus-5-thinking-max adversarial).
| } | ||
| } | ||
|
|
||
| ipcMain.handle('open-install-window', async (event, installationId: unknown) => { |
There was a problem hiding this comment.
🟢 Low — Registration moved from module scope into the app.whenReady() body, behind awaits like initDeviceId() and initUserTier(), and that promise chain has no .catch. Any earlier startup rejection now leaves open-install-window permanently unregistered, so every later invoke rejects with Electron's "No handler registered" error rather than the channel being inert. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max adversarial).
| const requester = [...comfyWindows.values()].find( | ||
| (entry) => entry.panelView?.webContents === event.sender | ||
| ) | ||
| await openBuild(installationId, requester?.windowKey ?? -1) |
There was a problem hiding this comment.
🟢 Low — The handler is re-entrant with no dedupe for an in-flight installationId: routing is decided synchronously before the await getInstallation(...) in the start-from-home branch, and the launching-id set is only populated once the renderer starts the build, so two rapid invocations for the same id both route to start-from-home and deliver two picker-pick-install messages. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max adversarial).
TL;DR: Open on a finished Copy now starts the new copy in its own window. It no longer leaves an empty Desktop window behind.
Why:
open-install-windowfocused the build's window when there was one. Otherwise it opened an empty Desktop window that stayed behind, and from a build window it never started the build.Can affect: only the
open-install-windowhandler insrc/main/index.ts.A follow-up to #2147, and the part of #2027 that #2147 did not cover.
Changes
open-install-windownow goes through the sameopenBuildrouter as the picker (routeBuildOpen, tested inregistry.test.ts). A build that has a window comes to the front. Any other build starts from the home window that asked, or from the home window when a build window asked, then opens in its own window.Not changed
Checks
src/main/hosttests pass.e2e/copy-update-destination.test.tsstill records the call. It was not run.