Skip to content

cmux-next: New Agent Chat opens a new workspace - #18137

Merged
teamleaderleo merged 9 commits into
feat-cmux-nextfrom
next-agent-chat-new-workspace
Oct 7, 2026
Merged

teamleaderleo merged 9 commits into
feat-cmux-nextfrom
next-agent-chat-new-workspace

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

New Agent Chat (Cmd-I, the menu, the palette) opens a new workspace whose only tab is the chat, and the window switches to it. This is section D of the 2026-10-06 call ("new agent chat opens in a new workspace unless told otherwise").

It copies the Codex and Claude desktop apps, where a new chat is a new thread with the chat alone on the left. References in manaflow-ai/cmux-app-screenshots:

  • captures/codex/app-tour-20261003/39-right-panel-changes-diff-view-nosidebar.png
  • captures/claude/desktop-code-20261003/03-browser-panel-open-instantly.png

How it behaves:

  • Starting state: the chat starts from the focused tab's cwd and draft (selected text, a page's title and URL), as a new chat tab does (cmux-next tabs: switch between terminal, browser and agent and keep the context #16620).
  • No terminal: none is created for the workspace. It goes through WorkspaceCreation.newTabPage, the path a person's new workspace already uses for the New Tab page, with a chat in place of the page.
  • Chat in the current pane: Cmd-T or the strip's + on a chat tab still opens a chat tab in that pane.
  • Scripts: CLI/MCP calls, a call aimed at a specific pane, and a daemon that can't hold a chat keep the old behavior: a tab in the pane.
  • Docking: the chat column is not docked here. A workspace with one column can't dock it (lastScrollingColumn). The next PR docks it when the first terminal or browser opens to its right.

Not added: a setting to turn this off. A Settings row would also need the settings page's locale bundles rebuilt (build-pages-web.sh, bun), which this lane doesn't run. It can follow if wanted.

Testing

AgentChatNewWorkspaceTests was committed red before the fix. Both runs used ./scripts/ci/package-test-lane.sh suite Packages/macOS/CmuxNext <suites> on a fleet runner. TopologyDaemon now answers new-conversation-tab into a workspace.

Commit Result
9d30619 (red) aPersonsNewAgentChatOpensAWorkspaceWithOnlyTheChat failed: no create-workspace was sent, so the chat went into the focused pane. aScriptsNewAgentChatStillOpensATabInThePane and AgentHandlerTests passed.
512cc80 (green) passed: AgentChatNewWorkspaceTests, AgentHandlerTests, WorkspaceSpawnFirstTabTests, AgentHomeNewChatTests, AgentHomeTests, AgentPaneShortcutsTests, LeaderLayerTests, SurfaceTabBarTests, NewTabKindTests

feat-cmux-next was merged afterwards (b430f1c). It changed none of these files.

Live check on a capture mini, fleet build of b430f1c (job 2d9924b6): Cmd-I (a real foreground key event) with a terminal at ~ focused opened workspace-3. The window switched to it, its only tab is the chat, and the composer had focus. The chat started in its own agent-home folder, not ~, which matches AGENT-CWD-FOR-FOLDERLESS-WORKSPACE. No terminal was created.

User-facing strings: none added.

Not run: a review sub-agent (lane rule: no sub-agents).

Review fix (Cursor): a chat whose tab the tree listed before new-conversation-tab replied took no seed, so it lost the focused tab's folder and draft. AgentChatNewWorkspaceTests.aChatShownBeforeTheReplyStartsFromItsSeed was committed first (bd2b917; its red is a build failure, since the seed handoff did not exist) and passes with the fix 9c038cc in hosted swift test. After base affcfe5, the test daemon advertises conversation-tabs-v1, which new-conversation-tab now requires.

Proof

Before (terminal focused) and after Cmd-I. Host names are redacted.

before
after

Changelog

Changed: in cmux-next, New Agent Chat (Cmd-I) opens a new workspace with the chat instead of a tab in the focused pane.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

New Agent Chat (Cmd-I, the menu, the palette) now opens a new workspace whose only tab is the chat, and the window switches to it, matching the Codex and Claude desktop apps. The chat inherits the focused tab's cwd and draft even when the tree shows the tab before the daemon replies, and no terminal is created for it. CLI/MCP calls, pane-targeted calls and daemons that can't hold a chat still open a tab in the pane; no setting to turn this off was added.

In this lane

  • Add Harness uses the same pane-resolution path, so it works from Home and settling workspaces too.
  • Pinned workspace tiles, Add to Top and a one-time lossless legacy pin move; pin changes undo through a toast and Cmd-Z.
  • Agent status indicators: working dots and a still needs-input dot, sourced from ACP turns, terminal hooks and OSC 7501 program status, each with its own tab switch.
  • Device-wide Chats feed with an opt-in sidebar section and palette page; agents.chats.* managed roots settings.
  • Web bundles are now build output: gitignored and built by build-web-bundles.sh in every build path; the cmux-tui tree publishes Linux daemon binaries.
  • Onboarding: closing the first run means "not now" for two launches; Continue Setup brings it back.
  • MessagesLab sidebar v1.1 vendored, and DEV/NIGHTLY builds crash at an Objective-C exception's throw site.

Written for commit 164b6f3. Summary will update on new commits.

View guided diff Turn on auto-fix


Note

Medium Risk
Changes default workspace creation and tab seeding for a core user shortcut; race handling around daemon/tree timing adds complexity, though scripts and targeted invocations are gated off the new path.

Overview
New Agent Chat (Cmd-I, menu, palette) for a person now creates a new workspace whose only tab is the chat—the window switches to it—and no terminal is spawned. The chat still inherits the focused tab’s cwd and draft via WorkspaceSpawn.firstChat and the existing workspace “first tab” path (WorkspaceCreation.newTabPage / openFirstPage(..., chat:)).

Automation and legacy behavior are unchanged: CLI/MCP, an explicit pane target, or a daemon that can’t host chats still open a tab in the focused pane (openNewAgentChat).

Seeding race: AgentTabStore holds a per-workspace chat seed (firstChats / seedFirstChat / firstChatSeed) so if the tree lists the tab before new-conversation-tab replies, the pane view still gets the seed. AgentPaneSeedSource.take() is now public for tests.

Tests: AgentChatNewWorkspaceTests and TopologyDaemon handling for workspace-scoped new-conversation-tab.

Reviewed by Cursor Bugbot for commit 164b6f3. Bugbot is set up for automated code reviews on this repo. Configure here.

teamleaderleo and others added 3 commits October 6, 2026 17:22
…y the chat

Red: Cmd-I opens a chat tab in the focused pane today.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cmd-I, the menu and the palette open a workspace whose only tab is the
chat, seeded with the focused tab's cwd and draft, and the window shows
it, like a new thread in the Codex and Claude apps. No terminal is made
for it. Scripts and an explicit target still get a tab in the pane.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8f5dd050-1071-460c-961d-0ee04c020c0e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Not verified: macOS jobs did not run: compile and app tests were skipped on 164b6f3861; ci-status is green without them.

CI passes on 164b6f3861 (run 37666407572 attempt 1).
macOS jobs did not run: compile and app tests were skipped: Fast static checks skipped (the macos job needs both to succeed). Re-run CI once they pass, before merging.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

@lawrencecchen

Copy link
Copy Markdown
Contributor

Review (correctness read, nx-docked-column lane). Concrete defects:

  1. Cmd-I in a workspace with no mounted pane still opens the chat in the current workspace. openNewAgentChatWorkspace runs only inside if let pane = context.scope(invocation).pane. The fallback branch below it (an empty or settling workspace) still repairs the active workspace with newTab.sameKind and opens a chat tab there. That is the case right after Cmd-N or first launch, so a person's Cmd-I gets two behaviors depending on mount timing. The new-workspace path needs no pane: take the seed and cwd from the focused pane when one exists, else nil and the daemon default, and create the workspace in both cases.
  2. The workspace appears only after the seed read finishes. await source?.take() runs before createWorkspace. For a browser tab that is a page evaluate (up to the seed limit), so Cmd-I shows nothing until it returns. openFirstPage already accepts a seed source per key; pass the AgentPaneSeedSource through (or its cwd only) and let the page read the draft lazily, as in-pane chats do.
  3. Scope note, not a defect: L3 in the dogfood call says palette, Cmd-I, CLI and MCP share one path, and a caller may name a target workspace. Here a CLI/MCP run without a target keeps the in-pane tab, and palette.newAgentChat still has targets: [.pane], so cmux agent new-chat --target workspace:<id> is refused. I have that part (targets: [.pane, .workspace] plus a handler) on a branch and can hand it over.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

Comment thread Packages/macOS/CmuxNext/Sources/CmuxNextApp/Handlers/AgentHandlers.swift Outdated
Comment thread Packages/macOS/CmuxNext/Sources/CmuxNextApp/AgentTabs+Wiring.swift
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@blacksmith-sh

This comment has been minimized.

teamleaderleo and others added 3 commits October 7, 2026 09:09
…ersation tabs

Since affcfe5 the app refuses new-conversation-tab on a daemon that
does not advertise conversation-tabs-v1, and TopologyDaemon advertises
only the required capabilities, so the chat was never created and the
test's force unwrap crashed the suite. The fixture now advertises it,
and a missing chat fails the test through #require instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…its seed

Cursor review on #18137: the tree can list the chat before
new-conversation-tab replies, and a view built then took no seed, so the
focused tab's folder and draft never reached the new chat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re the reply

openFirstPage held the chat seed only after new-conversation-tab
replied. The tree can list the tab first, and a pane showing it built
the view with no seed, so the chat lost the focused tab's folder and
draft. The seed is now held under the new workspace before the request;
a view built meanwhile takes it (tab, pane, workspace in the store), and
otherwise it moves to the tab's key on the reply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@blacksmith-sh

This comment has been minimized.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 164b6f3. Configure here.

guard !firstChats.isEmpty, let tab = store.tab(id: key), let pane = store.pane(containing: tab.surface),
let workspace = store.workspace(containing: pane.handle) else { return nil }
return firstChats.removeValue(forKey: workspace.handle)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Chat seed handle collides across daemons

Medium Severity

firstChats is app-global but keyed only by WorkspaceHandle, a per-daemon integer. firstChatSeed then takes that entry from whatever store owns the tab being shown. A first-time agent view on another machine whose workspace id matches can consume the pending seed, so the new chat loses its cwd and draft and another tab can inherit them.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 164b6f3. Configure here.

@teamleaderleo
teamleaderleo merged commit 410f54e into feat-cmux-next Oct 7, 2026
57 of 62 checks passed
@teamleaderleo
teamleaderleo deleted the next-agent-chat-new-workspace branch October 7, 2026 18:40
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.

2 participants