feat(desktop): set up a host over SSH from Settings → Hosts
Merged
KI
2mo ago+939+939+012345678901234567890123456789-81-81-01234567890123456789
Links
- Plan:
plans/20261010-add-host-over-ssh.md(phase 2). Builds on #8386 (API) and #8388 (superset hosts add).
Summary
- Settings → Hosts gets a Set up a host over SSH row at the top of the host list.
- It opens a dialog that asks for the SSH destination and runs
superset hosts add <target>in an embedded terminal. Passwords, MFA, host-key questions and the install prompt work as in any terminal, with no new UI for each.
How it works
- Terminal: the dialog reuses
CommandTerminal, the workspace-free terminal the GitHub sign-in dialog uses. The phases are form, running, success (exit 0) and failed (Retry, with an editable target). The dialog can't be dismissed while the command runs. On success it invalidateshost.roster, so the new host appears in the list. - Auth: the command sets
SUPERSET_ORGANIZATION_ID. These terminals already setSUPERSET_WORKSPACE_ID, so the bundled CLI takes the app account's token from the local host (host.apiToken, #8274), as it does in a workspace terminal. No second login is needed and no token appears in argv. With no local host, or an older one withouthost.apiToken, it runssuperset auth loginfirst. - Safety: the target is shell-quoted and must not contain spaces or start with
-. The CLI now refuses a leading-too, so ssh can never read the target as an option (-oProxyCommand=…).
Manual QA (dev app over CDP, port 9555, renderer on this worktree's 6965)
- The sidebar row opens the dialog with focus in the input. "Set up" is disabled when the input is empty and for
-oProxyCommand=evil. - End to end against a Docker Ubuntu box with systemd (
ssh://dev@127.0.0.1:2233). The dev shim was pointed at a production CLI build for this run, because the box talks to production:- the host-key question was answered in the embedded terminal;
- the password prompt worked; a first try failed on timing, which showed the failed state (warning line, output kept, Retry), and Retry then succeeded;
- the output showed signed in, systemd user service started, online, and the gh warning;
- the dialog then showed "The host is online…" with Done.
- Host-token auth with no CLI login: against the dev host,
auth whoamireportsauthSource: host, andapiKey.createwith that token mints a key (revoked afterwards). - The new host appearing in the sidebar: not seen in dev, whose roster is the dev database while the box registered in production. The roster invalidation runs on exit 0.
After review fixes (912cf3b)
- Escape and ✕ cannot close the dialog during setup. Checked over CDP: Escape mid-run, the dialog stays open and no close button is rendered; the ✕ returns when setup finishes.
- Empty-state button removed. Its dialog lived inside the "no hosts" branch and unmounted when the first host appeared. The sidebar row sits in the hosts layout, which stays mounted.
- The description now says "signs Superset in to your account", retranslated in all 16 locales.
- Filmed end to end over CDP, with the frames on the feature page: https://app.superset.sh/page/scripts-can-now-wait-on-agents-press-keys-attach-a-158c55 (section 5).
UX pass (256abe3), every path driven over CDP with real mouse and keyboard input
| Path | Result |
|---|---|
| Cancel during setup | Returns to the form and ends hosts add and ssh. This found a bug: React reused the Cancel element as the submit button, so a click restarted setup. Fixed. |
| Focus | The terminal has focus when setup starts; the host-key yes was typed with no click. A status line says to answer prompts there. |
| Agent key | Logged in with no password (dev needed SSH_AUTH_SOCK passed through turbo; packaged apps get it from launchd, checked on Canary). |
| Unknown name / refused port / wrong password ×3 / password after 130 s | Each shows ssh's own line plus a matching hint. The 130 s case is sshd's 120 s LoginGraceTime, which it closes without logging. |
| Fresh box (no CLI, lingering off, sudo asks for a password) | Install consent prompt → installer ran → after Retry: lingering prompt → sudo password → online, Linger=yes, service active. |
| No CLI login and no host manifest | superset auth login appears inside the dialog; Cancel stops it. |
| Success | "Open host" replaces Set up and opens the new host's page. |
| Wrapping | CLI messages, yes/no questions and error hints wrap at word boundaries. |
Final end-to-end run on a0555330 (after cleanup)
- CLI against the Docker Ubuntu box, production API:
hosts add→ signed in, systemd service started, online. A re-run reports "Already signed in" and "service unchanged".hosts remove→ service gone, no host processes, key revoked. - Dialog over CDP (dev app, real mouse and keyboard):
- host-key question answered with no click (the terminal had focus);
- agent-key login, online, then "Open host" opened
/settings/hosts/<id>; - Cancel at the password prompt returned to the form and left no setup process;
- a refused port showed its hint.
- Cleanup: the dialog quotes its command with the existing
quoteShellTokeninstead of a private copy; restating comments removed; the systemd and launchd names are no longer exported.
Testing
bun testforbuildHostsAddCommand: quoting, and refusing option-like targets.bun run check:i18n: the six new strings are translated in all 16 locales.bun run lint. Desktop typecheck shows only the existing better-auth type errors (onboardedAtand similar); none in the changed files.
Known limitations
- Hosts running a desktop build without
host.apiToken(before #8274) fall back tosuperset auth loginin the dialog. - Docs for the whole SSH set (CLI reference and the docs site) come in a follow-up, now that every piece is in.
Summary by cubic
Adds the ability to set up a new host over SSH from Settings → Hosts. A new row at the top of the host list opens a dialog that runs superset hosts add <target> in an embedded terminal, so password, MFA, and host-key prompts behave exactly as they would in a terminal.
Setup flow
- The dialog has form, running, success, and failed states; on success it refetches the host roster so the new host appears.
- The command sets
SUPERSET_ORGANIZATION_IDand signs in through the local host's API token, so no re-login is needed; without a local host, it runssuperset auth loginfirst. - The terminal gets focus when setup starts, and Open host replaces Set up on success. Open host reads the new host's id from the command's output, whether the "(id) is online" line or the JSON result for agent environments that print neither.
- The dialog can't be dismissed while setup runs; Cancel ends the session and returns to the form.
Safety
- The destination must not contain spaces or start with
-, and the CLI now rejects leading-dash targets so ssh can't interpret the input as an option. - The target is shell-quoted before being passed to the command.
- ssh failures now explain the cause (wrong password, changed host key, slow answer, unreachable port); the changed host-key hint points at the
ssh-keygen -Rcommand ssh already printed. CLI messages and errors wrap at word boundaries on narrow terminals.
Summary by CodeRabbit
- New Features
- Set up a host over SSH from Hosts settings. Enter an SSH destination to install and run Superset on a remote machine; follow setup progress and errors in the dialog, retry failed setup, or open the host when it’s ready.
- Once online, the host can be selected when creating a workspace.
- Bug Fixes
- SSH destinations beginning with a dash are rejected to prevent invalid connection targets.
- SSH connection failures now include more specific troubleshooting guidance, and long terminal messages are easier to read.