Skip to content

Open a thread in its own window (detached thread windows, #519) - #1645

Merged
currentbits merged 2 commits into
mainfrom
coder/multi-window-support-detach-a-thread-int-78597a
Oct 16, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/multi-window-support-detach-a-thread-int-78597a

Conversation

@currentbits

Copy link
Copy Markdown
Owner

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:

  • Context menu: "Open in new window" on a sidebar thread card.
  • Keyboard: ⌘⇧O (thread.detach) on the selected thread.
  • Drag: drag a sidebar card and drop it outside the window.

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 tagged solentaThreadId.
  • Closing a detached window always closes it. The macOS hide-on-close behavior only applies to the main window.
  • New window:detachThread IPC handler (desktop only, like contextMenu:show). It checks that the thread exists, then focuses the existing window or opens a new one.
  • New 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 dock activate handler now reopen the fleet window when only detached windows are left. A new sendWhenLoaded waits 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, droppedOutsideWindow and detachedWindowTitle.
  • 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.
  • The bridge is exposed as coder.windows.detachThread (preload, CoderApi), and windows is listed as a non-channel API extra in ipcChannels.ts.

Tests

test/detachedWindow.test.tsx covers the new helpers.

🤖 Generated with Claude Code

Solenta-Message-Id: 672920ba-6227-4ab1-983a-0e0b9c9f0652

@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: 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".

Comment thread electron/main.js
Comment on lines +369 to 370
threadId ||
!shouldBlockWindowClose({

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 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 👍 / 👎.

Comment thread src/App.tsx
Comment on lines +599 to +603
// A detached window stays on its thread; links elsewhere get their own.
if (detachedId && id !== detachedId) {
detachThread(id);
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@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-16T07:53:35.843281Z b26d772 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.

@currentbits
currentbits merged commit 3564344 into main Oct 16, 2026
6 checks passed
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