Repository navigation
Open a thread in its own window (detached thread windows, #519) - #1645
Conversation
Solenta-Message-Id: 672920ba-6227-4ab1-983a-0e0b9c9f0652
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b26d77217a
ℹ️ 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".
| threadId || | ||
| !shouldBlockWindowClose({ |
There was a problem hiding this comment.
Base quit guarding on whether this is the last window
On Windows/Linux with active work, this condition no longer preserves the last visible window correctly: closing a detached window always destroys it, so if it is the final window, window-all-closed calls app.quit() and cancelling the active-work confirmation leaves the process running with no window. Conversely, closing the main window while a detached window remains still invokes app.quit() and closes every window. Determine whether another app window remains before bypassing or initiating the quit path.
Useful? React with 👍 / 👎.
| // A detached window stays on its thread; links elsewhere get their own. | ||
| if (detachedId && id !== detachedId) { | ||
| detachThread(id); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Enforce the detached-thread lock for direct selection paths
This guard only covers callers of handleSelectThread, but actions available inside ThreadView can change selection directly. For example, the Fork action reaches useCoderRuns.forkThread, whose setSelectedThreadId(t.id) bypasses this callback, causing a ?thread=A window to display fork B while its URL and title remain tied to A. Route these selection-producing actions through the detached guard, or enforce the lock where selection state is mutated.
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
What
Adds detached thread windows on desktop. A thread can open in a window of its own, locked to that one thread, while the main window stays the fleet overview. Both windows get the same pushes, so they stay in sync.
Three ways to detach a thread from the main window:
thread.detach) on the selected thread.If the thread already has a window, that window is focused and no second one opens.
How
Main process (
electron/main.js)createWindow({ threadId })opens a narrower window (960 wide, min 920, which stays above the 900px narrow breakpoint so no drawers appear). The thread id goes into the page as?thread=<id>, and the window is taggedsolentaThreadId.window:detachThreadIPC handler (desktop only, likecontextMenu:show). It checks that the thread exists, then focuses the existing window or opens a new one.focusThread(id): deep links and notification clicks for a thread go to its detached window if one is open, otherwise to the main window with the thread selected.focusMainWindow()and the dockactivatehandler now reopen the fleet window when only detached windows are left. A newsendWhenLoadedwaits for a freshly reopened window to finish loading before sending*:select, so the push isn't dropped.Renderer
src/detachedWindow.ts(new) holds the helpers:detachedThreadId,canDetachThread,detachThread,droppedOutsideWindowanddetachedWindowTitle.App.tsx: in a detached window the sidebar, rail toggle and narrow threads button are hidden. Selecting another thread (for example from a link) opens that thread in its own window instead of switching. The document title shows the thread name, with a●prefix while it waits on the user. The window closes itself once its thread no longer exists.useCoder.ts: a detached window starts with its thread selected from the first paint. It skips saving the boot snapshot so it doesn't overwrite the main window's selection.coder.windows.detachThread(preload,CoderApi), andwindowsis listed as a non-channel API extra inipcChannels.ts.Tests
test/detachedWindow.test.tsxcovers the new helpers.🤖 Generated with Claude Code