acpmux: one SelfCommand for every start of this binary (router and hand under acp)
In progress: fleet test results to follow.
Summary
Follow-up to #23122. Inside cmux-tui (on Linux, current_exe resolves an acpmux link to it), acpmux reaches its own subcommands only as cmux-tui acp <word>. #23122 fixed this for the agents' MCP servers. Two other places still started current_exe without the prefix:
daemon/router_owner/fifo.rs: the local router ran<cmux-tui> router serve, which goes to the cmux CLI, not acpmux's router.hand/daemon.rs: the hand's keyed start ran<cmux-tui> daemon start --person-key-fd 0, which also goes to the cmux CLI.
A new self_command.rs holds the logic once: SelfCommand::current() is current_exe plus daemon::daemon_prefix(), modeled on HostLauncher::current (agent_host/link.rs), which now uses it too. Every place that starts this binary with an acpmux subcommand builds its command from it: the detached daemon (daemon.rs spawn_detached), agent hosts, the bundled adapter argv (config/discover.rs), the agent tools' cua-mcp/secret-mcp/offer-mcp/subsession-mcp servers (agent_tools::Inputs.acpmux is now a SelfCommand), the router and the hand's keyed start.
cli/hosts.rs push_binary gets its path from the helper but takes no prefix. It only copies the file to the remote ~/.local/bin/acpmux, and cmux-tui runs a file named acpmux as acpmux by argv0, so the remote copy and its daemon need none. Not changed: the Windows router start (daemon/windows.rs), because on Windows acpmux is its own .exe and cmux-tui doesn't route acp.
Testing
New unit tests, each with an empty prefix (standalone acpmux) and with acp (cmux-tui):
self_command::tests::subcommands_follow_the_prefix:args,commandandtokio_commandput the prefix before the words.daemon::router_owner::fifo::self_command_tests::the_router_starts_under_the_daemon_prefix:router servevsacp router serve, from the helper's exe.hand::daemon::self_command_tests::the_keyed_start_runs_under_the_daemon_prefix:daemon start --person-key-fd 0vsacp daemon start --person-key-fd 0.agent_tools::tests::own_servers_run_under_the_daemon_prefix(from #23122) now builds its inputs fromSelfCommand.
Results to follow.
Changelog
none
🤖 Generated with Claude Code
Agent session: cosmic-gray
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the local router and the hand's keyed daemon start so a Linux acpmux link (which resolves to cmux-tui) runs acpmux subcommands instead of the cmux CLI: these now spawn <cmux-tui> acp router serve and <cmux-tui> acp daemon start --person-key-fd 0.
A new self_command.rs holds current_exe plus the daemon prefix once, and every place that starts this binary with an acpmux subcommand (detached daemon, agent hosts, bundled adapter, agent tools' MCP servers, router, hand) builds its command from it. host setup copies only the file and needs no prefix; the Windows router start is unchanged. Unit tests cover both the standalone binary and the acp prefix inside cmux-tui.