cmux NEXT: New Agent Chat from the CLI/MCP in a pane or workspace no window shows
Fixes #23016. Related: #23026, https://github.com/manaflow-ai/cmux/pull/23074.
New Agent Chat (palette.newAgentChat: cmux agent new-chat, MCP app_agent_new_chat) now works on a pane or workspace that no window shows, without moving the person's focus.
What changed
- Unshown pane or workspace. A run that targets a pane or workspace no window shows now opens the chat tab on the workspace store (
AgentChatPlacement). Before, it was refused with "That pane is no longer open." No window, workspace or focus changes. The tab is selected in that pane, so it is the tab shown when someone opens the workspace. The run answerstab,pane,workspaceandworkspace_key, so a script can find the chat it made. - Workspace target. The action now also takes a workspace target. The chat opens in that workspace's most recently focused pane. Before, a workspace target fell back to the focused window's pane, which could be a different workspace.
cwdargument. The action takes an optionalcwd: the folder a chat opened by a script starts in. Without it, the chat starts in the workspace's agent folder, else the folder of the pane's selected tab.- A pane that a window shows takes the existing path, unchanged.
Not in this PR
https://github.com/manaflow-ai/cmux/pull/23074 (for #23026) covers the rest of #23016:
cmux agents chat newandagents_chat_new, with harness, model, effort, policy and mode.agents chat state|interrupt|continue.agent.openSessionWorkspace --pane|--workspace.- Pane and tab screenshots for agents. That PR is
risk:highbecause it changes socket policy.
This PR has none of those changes, so the two PRs do not conflict.
Tests
Tests/CmuxNextAppTests/AgentChatInUnshownPaneTests.swift,aScriptOpensAChatInAWorkspaceNoWindowShows(pane|workspace). It runs the real app services against the same-tree daemon. It creates a workspace that no window shows, then runspalette.newAgentChatfrom the CLI origin throughRegistryControlBridge, theaction.runpath. It checks three things: the chat tab lands in that pane, the run answers its ids, and the window stays on its workspace. The test is committed before the fix (1fa77a381b89). On the base it fails with the "That pane is no longer open" refusal.
Observed / Not run
No capture: no visible UI changes. The change is in the CLI/MCP path (palette.newAgentChat aimed at a pane or workspace no window shows), and it is designed to show nothing and leave focus alone. A pane a window shows takes the existing path, unchanged.
- Merged current feat-cmux-next at fdf21cc8354f; resolved one conflict in
AgentActionCatalog.swift(kept base symbolbubble.left.and.bubble.right, kept this PR'scwdargument and[.pane, .workspace]targets). - Not run locally: Swift build/tests (heavy builds go to CI);
AgentChatInUnshownPaneTestsruns in CIcmux-next swift test.
Changelog
- Fixed: New Agent Chat from the CLI or MCP opens in a pane or workspace no window shows, without taking focus.
š¤ Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes #23016. New Agent Chat (palette.newAgentChat via CLI or MCP) now opens on any pane or workspace it targets, shown or not, without moving focus or switching workspaces. Previously, targeting an unshown pane was refused with "That pane is no longer open." Now the chat tab opens on the workspace store in that pane, selected so it is shown when someone opens the workspace, and the run answers the tab, pane, workspace, and workspace_key ids. A pane a window shows also takes this path for a script's run: it opens the tab, keeps the pane's selected tab, and answers the ids. A person's run (context menu) and a run that asks for focus keep the existing shown-pane behavior. A workspace target opens in that workspace's most recently focused pane, and the action takes an optional cwd for the chat's starting folder. Tests run the real app services against the same-tree daemon.
Merged from feat-cmux-next
- Suggested tasks (
sessions.promptSuggestions) are now on by default; the Debug toggle only forces them on. - A sidebar workspace's hover card lines up with its row's top; rows no longer show "Done" or working time.
- Failed prompts on the agent page group by cause into one card per cause, with a Trust folder action when a folder's trust question is pending.
- Subagent workspaces an older host made on the Chief daemon move into the user's session at host start, keeping their tabs and group.
Changelog
- Fixed: New Agent Chat from the CLI or MCP opens in a pane or workspace no window shows, without taking focus.