Skip to content

fix: show the canvas, not a blank panel, while a picker op stops the instance - #1725

Open
benceruleanlu wants to merge 3 commits into
bl/mcp-setup-keeps-pagefrom
bl/bg-op-holds-comfy-body
Open

benceruleanlu wants to merge 3 commits into
bl/mcp-setup-keeps-pagefrom
bl/bg-op-holds-comfy-body

Conversation

@benceruleanlu

@benceruleanlu benceruleanlu commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

A picker op that stops a running instance (inline update, snapshot restore, copy) no longer leaves a blank panel when the window is resized or a title-bar modal opens or closes mid-op. The canvas stays up until the op finishes. Then the window shows the relaunched canvas, or the stopped page if the instance didn't come back.

Stacked on #1724 (MCP setup), which is stacked on #1719 (Send Feedback) and #1712 (What's New).

Behavior

  • The bug: refreshComfyTabBody returned early while a picker op was in flight, skipping both the panel-switch IPC and layoutViews(). But computeBodyMode already said 'comfy-lifecycle' because the instance had stopped. Any later layout pass (window resize, openPanelModal / hidePanelModal) applied the lifecycle layout (panel shown, canvas hidden) while the panel renderer was still on its empty 'comfy' body.
  • The fix: the op holds the instance's canvas. computeBodyMode returns 'comfy' while the hold is in place, so every layout path, bodyLayout, isCanvasOverlay and focus agree with what the renderer was last told. A modal opened mid-op sits transparently over the canvas and closes back to it.
  • Release: pickerRunBackgroundOp drops the hold in a .finally, which re-runs refreshComfyTabBody. Before this, nothing refreshed the body when an op settled, so a failed, cancelled or non-relaunching op (e.g. copy) left a stale canvas plus the same blank-panel trap. It now ends on the stopped page. A successful relaunch stays on the canvas.
  • Only a live canvas is held. If the instance was already stopped when the op started, holdCanvas does nothing and the stopped page stays through resizes.
  • Narrower suppression: refreshComfyTabBody now skips only while the canvas is held, not for every unfinished picker op. An op that doesn't stop the instance no longer swallows session changes, so a crash during one shows the crash page instead of leaving main and the renderer out of sync.

Why not just have computeBodyMode report 'comfy' for any unfinished op: on an already-stopped instance, that swaps the stopped page for the dead canvas on the next resize. It also lifts when the op ends without anything re-syncing the renderer, which brings the blank panel back.

Validation

  • New tests: a resize and a modal open/close mid-op keep the canvas, and no panel-switch is sent. The op ending sends the stopped page, or keeps the canvas after a relaunch. An already-stopped instance keeps its stopped page through a resize. computeBodyMode / bodyLayout honor the hold, including while the instance is still stopping.
  • Mutation checks: removing the hold from computeBodyMode reproduces the blank panel ({ panel: true, canvas: false } with no panel-switch) and fails the resize and modal tests. Dropping the re-sync on release fails 3 tests. Holding an already-stopped instance fails 1.
  • The two test files passed 25 shuffled repeat runs with no failures.
  • Unit suite: 6748 passed. src/main/lib/processIdentity.test.ts fails the same way on this stack's base; it is the time-dependent test fixed on main by test(processIdentity): fix same-second flake in readStartTimes real-process test #1721 and fix(process): read macOS lstart start times as UTC #1723.
  • Typecheck (node, web, e2e, integration), lint and format pass.
  • Not yet checked by hand in the packaged app.

Change breakdown

178 changed lines (additions + deletions), relative to #1724:

  • Product: 3 files, +25/-6, 31 lines (17.4%): src/main/host/panelView.ts, src/main/host/registry.ts, src/main/index.ts
  • Tests: 2 files, +147/-0, 147 lines (82.6%): src/main/host/panelView.test.ts, src/main/host/registry.test.ts

No documentation, configuration, generated, lockfile or vendored changes.

Send Feedback was the same kind of panel key What's New was, so closing it
landed on the dashboard and dropped a running performance test or a
half-filled wizard. It is now the second title-bar modal kind: the page
underneath stays mounted and inert, and closing it leaves that page in place.

Only one title-bar modal is open at a time. The renderer keeps both in one
shared state, so swapping What's New for Feedback happens in one render and
the panel over the canvas never drops its transparency. Feedback shares
What's New's layering through BaseModal's new `coversPage` option: it sits
below other dialogs, leaves an open dialog its focus, and takes Escape before
a wizard underneath.
MCP setup was the last overlay still modeled as a panel key, so it sat
above What's New as a dialog and clicking the bell over it did nothing
visible. It is now the third title-bar modal kind: one modal at a time,
opening What's New replaces it, and it shares the page-cover layering,
focus and Escape handling through BaseModal's `coversPage`.

With no overlay panel keys left, a canvas overlay is just a running
canvas with a modal open.
…instance

An inline picker op that stops a running install (update, restore, copy)
suppressed refreshComfyTabBody so the lifecycle page wouldn't flash, but
computeBodyMode still reported 'comfy-lifecycle'. A resize or a title-bar
modal open/close then laid out the lifecycle panel while its renderer was
still on the empty 'comfy' body, leaving a blank panel.

The op now holds the install's canvas: computeBodyMode reports 'comfy'
while held, so every layout path agrees with the renderer. Releasing the
hold when the op settles re-syncs the body, so a failed or non-relaunching
op ends on the stopped page instead of a stale canvas. An install that was
already stopped is never held and keeps its lifecycle page.
@benceruleanlu
benceruleanlu added this pull request to stack #1720 October 13, 2026 22:31
@benceruleanlu
benceruleanlu requested review from a team as code owners October 13, 2026 22:31
@benceruleanlu benceruleanlu changed the title bl/bg op holds comfy body fix: show the canvas, not a blank panel, while a picker op stops the instance Oct 13, 2026
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: c61e7178-47cc-4a5d-af4c-5c365920b622
📥 Commits

Reviewing files that changed from the base of the PR and between f64dbc6 and 3854ed6.

📒 Files selected for processing: 5
  • src/main/host/panelView.test.ts
  • src/main/host/panelView.ts
  • src/main/host/registry.test.ts
  • src/main/host/registry.ts
  • src/main/index.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

📝 Walkthrough

Required-stop picker background operations now hold the Comfy canvas while an instance stops. Layout keeps the canvas visible until release, then reflects the instance’s current running or stopped state. Tests cover refreshes, relaunches, and modal behavior during the hold.

Changes: Held Comfy canvas

Layer / File(s) Summary
Held-canvas state and layout
src/main/host/registry.ts, src/main/host/panelView.ts, src/main/host/registry.test.ts
The registry tracks held installation IDs and keeps the Comfy body mode while an ID is held. The panel view adds a hold helper that refreshes the body on release. Registry tests cover layout while held and after release.
Picker hold lifecycle
src/main/index.ts, src/main/host/panelView.test.ts
Required-stop picker operations acquire a hold before stopping a running installation and release it when the operation settles. Panel-view tests cover layout refreshes, relaunches, and modal behavior during the hold.

Sequence Diagram(s)

sequenceDiagram
  participant PickerOperation
  participant holdCanvas
  participant heldCanvases
  participant stopRunning
  participant PanelView
  PickerOperation->>holdCanvas: acquire hold for running installation
  holdCanvas->>heldCanvases: add installation ID
  PickerOperation->>stopRunning: stop installation
  PanelView->>heldCanvases: check hold during body refresh
  PickerOperation->>holdCanvas: release hold when operation settles
  holdCanvas->>heldCanvases: remove installation ID
  holdCanvas->>PanelView: refresh body after release
Loading

Suggested reviewers: kosinkadink

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 3854e

No actionable merge-blocking defect is established for the canvas-hold change. The possibility of overlapping holds remains unverified.

Security architecture risk: 🔵 Low · up to 3854e

The change primarily controls which page stays visible while an operation finishes. Completion releases the hold, including failure paths. No new security issue was established, but overlapping operations and the effect of continued canvas interaction remain incompletely assessed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The new shared mutable state is keyed by installation ID and consumed by desktop host visibility and refresh logic. It is not added to the running-session record or persisted by the inspected implementation.

Trust Boundaries and Controls

  • observed — The registry resolves title-bar and Comfy senders through equality with registered WebContents identities. The new visibility hold does not modify those lookup functions. This establishes the available identity mechanism, not that every relevant handler enforces it.

Resilience and Maintainability Implications

  • inferred — Picker initiation does not reserve operation ownership before its first await; action handlers claim ownership later. That ordering predates this PR. Synchronous session removal during stopping limits duplicate hold acquisition, and no introduced security or failure-containment impact from overlapping holds was demonstrated.
Pre-merge checks: Passed 2
Passed Passed checks: 2 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3854ed65db

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (!_runningSessions.has(installationId)) return () => {}
heldCanvases.add(installationId)
return () => {
if (heldCanvases.delete(installationId)) refreshComfyTabBody(installationId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve picker focus when releasing the canvas

When an inline picker operation on a running install finishes, this release calls refreshComfyTabBody, which reaches focusActiveBody and focuses the canvas or panel. The instance picker is configured with hideOnPopupBlur: true in titlePopup.ts, so this focus transfer closes the still-open picker immediately after its terminal status is broadcast, preventing users from seeing the result or using the success CTA. Refresh the layout without stealing focus while the picker remains open.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T22:33:01.338880Z 3854ed6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant