acpmux: a cmux-tui daemon's sub-session MCP server runs under acp (cloud VMs)
Summary
On a cloud VM, agents never got the cmux-subsessions tools (start_session and the rest). The VM's acpmux daemon runs from cmux-tui (started as acpmux, a link, and Linux's current_exe resolves the link), so it wrote the server command as <cmux-tui> subsession-mcp. cmux-tui only runs acpmux when argv0 is acpmux or the first word is acp (main.rs argv0 check, then run_main's acp route), so that command fell through to the cmux CLI and the MCP server never started.
The daemon already knows its prefix: daemon::daemon_prefix() is acp when it runs inside cmux-tui, and HostLauncher::current starts agent hosts with it. agent_tools::resolve now puts the same prefix before the command word of every server that is this acpmux binary: subsession-mcp, secret-mcp, offer-mcp and the helper v2 bridge cua-mcp. A standalone acpmux (the app's bundled copy) has an empty prefix and keeps the bare word. The per-workspace display filter now finds the cua-mcp bridge by its word anywhere in its args instead of only as the first one.
Not changed: router serve (daemon/router_owner/fifo.rs) and the hand's daemon start (hand/daemon.rs) also start current_exe without the prefix. They aren't on this path; noting them for a follow-up.
Testing
cmux-tui/crates/cmux-tui/tests/acp_subsession_mcp.rs(new): starts a real daemon from thecmux-tuitest binary, both ascmux-tui acp daemon startand through a link namedacpmux, starts a chat with the stand-in agent, reads themcpServersthe agent got, runs thecmux-subsessionscommand with its env, and checksinitialize, thattools/listhasstart_session, and thatlist_sessionsreaches the daemon. On Linux it also asserts the link resolves to cmux-tui (the VM case).acpmuxunit testown_servers_run_under_the_daemon_prefix: with an empty prefix the four servers keep their bare word; withacpeach isacp <word>; per-workspace displays still drop the bridge.
Ran on huge-blue (Linux x86_64, Rust 1.95.0), cargo test --locked:
| Command | 5bbc608 (test only) | 334de4a (fix) |
|---|---|---|
-p cmux-tui --test acp_subsession_mcp | 0 passed, 2 failed | 2 passed |
-p acpmux --lib agent_tools | 6 passed (incl. own_servers_run_under_the_daemon_prefix) | |
-p acpmux --test agent_tools --test cua_v2_stale_endpoint --test agent_displays | 3 passed |
The red failure is the bug itself. Through the acpmux link the server came out as {"command": ".../debug/cmux-tui", "args": ["subsession-mcp"]}, so Linux resolved the link to cmux-tui as expected, and both cases failed with left: ["subsession-mcp"], right: ["acp", "subsession-mcp"]. With the fix, both cases start the server, tools/list has start_session, and list_sessions answers.
Running the built binary directly shows what an agent saw before:
$ echo '<initialize>' | ACPMUX_SESSION_ID=x cmux-tui subsession-mcp
cmux: unknown resource scope "subsession-mcp". (exit 2)
$ echo '<initialize>' | ACPMUX_SESSION_ID=x cmux-tui acp subsession-mcp
{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"tools":{}},"instructions":"Sub-sessions are ...
Observed / Not run
- Observed: the runs above. The new test runs the daemon from a
cmux-tuibinary through anacpmuxlink on Linux, which is the VM's setup. It doesn't use a real VM. - Not run: clippy and the full workspace suite (CI runs them), macOS (the standalone acpmux path keeps an empty prefix, which the unit test covers), and a live cloud VM.
Changelog
Fixed: Agents on a cloud machine can start and manage sub-sessions again (the cmux-subsessions tools start).
🤖 Generated with Claude Code
Agent session: cosmic-gray