cmux NEXT: agents open a session's chat as a tab of a pane (app_agent_open_tab)

Merged
TE
15d ago
+364-15

Summary

An agent can now open an existing acpmux session's chat as a tab of a pane, for example its sub-session's chat beside its own work. Before this, app_agent_open (agent.openSessionWorkspace) was the only tool, and it always made a new workspace.

  • New app action agent.openSessionTab:
    • MCP app_agent_open_tab {session, target?, host?, focus?}.
    • CLI cmux agent open-tab SESSION [--target PANE_OR_TAB] [--host H] [--focus].
  • Placement: the tab goes in the target pane. The target is a pane id, or a tab id whose pane it joins. Any workspace works, including one no window shows. With no target it goes in the focused pane.
  • The tab is a workspace store tab bound to the session, so it is saved and restored like any other tab. Closing it only detaches from the session.
  • No duplicates: a session a tab already shows gets no second tab; that tab is revealed only with focus: true.
  • Focus: an MCP or script run adds the tab without selecting it. Only a person's run, or focus: true, selects and shows it.
  • Docs now name it: the cmux-subsessions server instructions, the acpmux SKILL.md, agent-surfaces.md and cmux docs ("show the user").

The split with subsession-visibility (#22827, #23159) was agreed with its owner: this PR adds the tool, and that lane keeps the pane, transcript and summary UI. The start_session reply text stays with #22827.

Surfaces: CLI and MCP are offered, plus the keyboard (assignable shortcut). The palette and context menu are exempt (noObject), the same as agent.openSessionWorkspace, because both need a session id.

Changelog

Added: Agents can open an agent session's chat as a tab in an existing pane (app_agent_open_tab, cmux agent open-tab).

Tests

  • CmuxNextAppTests/AgentSessionTabTests:
    • a script run with a pane target asks the store for an agent tab in that pane, bound to the session;
    • a blank session is refused and opens nothing.
  • cmux-tui/tests/action_session_arg_app.rs agent_open_tab_opens_an_existing_session_as_a_tab_of_a_pane: the CLI form sends action.run for agent open-tab with target and session.
  • subsession_mcp unit test and hub_integration/session_offers.rs: the instructions call cmux.app_agent_open_tab(.
  • ActionContractTests: the palette-hidden list includes the new action.

No capture: automation-only action (MCP/CLI/shortcut); no palette, menu or visible UI changes, and the tab it opens is the existing agent chat tab.

Observed / Not run

  • Observed: the fleet cmux-ci compile-check --app passed on d2b2865c37701bb08a3ec106aac25e67f11d3881; prepush-gate.py found no new violations.
  • Not run here: the Swift and Rust tests (no local builds on this Mac); they run in this PR's CI. Generated action exports (plans/cmux-next/action-surfaces.json, actions.md) are not hand-edited; the autofix regenerates them. No live dogfood in a tagged build.

Agent session: cosmic-gray

🤖 Generated with Claude Code


Summary by cubic

Lets an agent open an existing session's chat as a tab of a pane instead of always creating a new workspace.

  • New action agent.openSessionTab (MCP app_agent_open_tab, CLI cmux agent open-tab SESSION [--target PANE]) adds the chat to the target pane, or the focused pane when no target is given.
  • The tab is a normal workspace tab bound to the session, so it is saved and restored like any tab; closing it only detaches from the session.
  • A session a tab already shows gets no second tab; only focus: true reveals the existing tab.
  • Script runs add the tab without selecting it; only a person's run or focus: true selects it.
  • Bare tab_, pane_, and ws_ target IDs now resolve to the kind their prefix names, so app_agent_open_tab with a tab_ ID no longer fails with not_found (it used to be treated as a pane).