cmux NEXT: one-click Add Machine (install, harness, peers both ways, doctor)

Merged
TE
1mo ago
+12671-737

Draft. One-click Add Machine for cmux NEXT. It is item 1 on the machine-mesh product map (cmuxterm-hq#2692).

The user types a host or picks a Tailscale peer, and cmux sets it up end to end:

  1. checks that key-only ssh works;
  2. installs cmux-tui, which carries acpmux;
  3. copies the harness profiles across;
  4. starts the agent daemon;
  5. registers the acpmux peer both ways;
  6. names the machine;
  7. shows a health checklist (doctor, with --fix).

The contract is in plans/cmux-next/add-machine-DESIGN.md. The logic is in Rust (cmux-tui acp host enroll|doctor|candidates), and the app adds machine.add / machine.doctor on top of it. Nothing depends on leo-workspace.

Still to come: installer and doctor (Rust), peer registration and Tailscale candidates (Rust), and the UI (Swift).

Agent session: cosmic-gray

šŸ¤– Generated with Claude Code


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


Summary by cubic

Implements the one-click Add Machine flow for cmux NEXT: the enroll/doctor checklist, peer registration, and the tailnet candidate list now run on the design doc and step contract, with the app's Add Machine card and Machines section wired on top.

  • cmux-tui acp host enroll|doctor|candidates run the seven-step sequence (reach, install, daemon, harness, peer, peer-back, identity) as one JSON line per step; doctor checks only unless --fix. Step lines carry an optional reason: only install's wrong-platform/not-this-program makes the app install its own build and enroll again.
  • Peer steps register the machine over ssh and, only with --reverse, register this machine back on the host; the app never passes --reverse. The peer url uses the daemon's port (ssh://host, else ssh://host:port), so doctor passes and --fix repairs a peer on another port. All ssh calls go through a Remote trait so tests use a fake host.
  • The daemon step shares host setup's installer: a pure daemon_config writes the websocket config over stdin to a fixed script, so the token is never in a command line, and the Linux restart via the user systemd unit runs in the shared installer.
  • On a Mac with cmux, install and daemon detect the app-bundle acpmux from the remote daemon's status (exe and runsAsCmuxTuiAcp, never argv; old daemons count as cmux's own) and won't push a second binary or start a second daemon beside the app's; the build-skew fix text follows the daemon's executable alone, a stopped app daemon fails with "open cmux on HOST", and a daemon started through ~/.local/bin/acpmux's link stays repairable by doctor --fix.
  • The tailscale CLI wrapper moved from cmux-tui into acpmux::tailnet so the app's remote hosting and host candidates share it; acpmux is now an all-platform dependency of cmux-tui.
  • host candidates --probe probes only the user's own machines, at most 32, and the probe deadline and cancel both signal the run's process group; the card shows the plain list first and keeps it if the probe fails.
  • An unhealthy report fails like other commands (JSON error envelope, exit 1, no process::exit), and the remote acpmux home is one REMOTE_HOME constant that install, doctor and enroll all build paths from.
  • The UI (machine.add, machine.doctor) opens a floating card that fills the checklist live, the Name field names the machine in the sidebar, and cancel signals the run's process group. machine.add with a destination only fills the card; Add starts the run. A cancel before the CLI launches means no launch at all, and finished() waits through a run that Fix or Try Again replaced.
  • Merged with the latest feat-cmux-next, including base's push_binary executable change (#23172) ported into enroll's install check; the generated action exports were re-merged three-way and their counts recomputed, and the settings exports keep base's defaults snapshot and stamp (this PR's only stamped change is SettingsSchema.swift).
  • Still out of scope: ssh key/config changes, sudo, and cloud machines.