Skip to content

Connect every saved host at the app's start - #55

Merged
enowdev merged 2 commits into
mainfrom
feat/auto-connect-hosts
Nov 10, 2026
Merged

enowdev merged 2 commits into
mainfrom
feat/auto-connect-hosts

Conversation

@enowdev

@enowdev enowdev commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Saved hosts now connect in the background when the app starts, and their sessions list under On other hosts as soon as each answers, without switching to it.

Cause. The app already followed every saved host it didn't show over a background connection (ui/watch.go), and listed their sessions. But that connection never read a saved password from the keychain (watchPassword in ui/secrets.go). A host signed in to by password therefore waited in "connect to sign in" until the user switched to it, which read the keychain. Only then did its sessions show.

What changed

  • Saved passwords: a background connection reads a host's saved password from the keychain, once per run. If none is saved, or the system's prompt is refused, it isn't asked again that run and the host waits for the user.
  • Timeout: each host connects on its own goroutine, all at once. One that hasn't answered in 2 minutes (an install of the daemon on a slow link included) counts as offline and is tried later; a connection that comes after that is closed. The app's start and the host shown never wait for them.
  • Retries: a host that is down shows "offline · retrying" in the Hosts list, with no dialog. It is retried with the existing backoff (15 s, doubling up to 5 min), and at once when the window comes back into sight or the machine wakes from sleep (the wall clock jumping ahead of the monotonic one).
  • Connect at start, in Hosts › ⋯ › Edit… and when adding a host (hosts.Host.NoStartConnect), is on by default, for hosts already saved too. Off, the host connects only once the user opens it, and is followed in the background from then on until the app quits.
  • Docs: docs/daemon.md, "Every saved host, from the app's start".

Still never automatic: a password not saved, an SSH key's passphrase, trusting a new server key, choosing whom to run as, a Tailscale SSH browser check. Those hosts show "connect to sign in" until the user opens them.

Tests:

  • TestHostsConnectAtStart, with stand-in connections:
    • hosts connect at once (three 400 ms hosts online in about 1.15 s);
    • a host's sessions list once it is up;
    • a host that never answers goes offline at the timeout;
    • a host that needs the user isn't retried by itself;
    • a host set not to connect at start waits until opened.
  • TestEditHostConnectAtStart: the switch at 900 and 520 px, saved and read back.
  • go test ./ui/... ./core/hosts/..., go vet and GOOS=windows go vet pass.

Not tried in the real app yet. In particular the macOS keychain prompt: after an update, macOS may ask once per host whether enowX can read the saved password. Sleep and wake, start-up time with an unreachable host, and the switch's look in the Edit dialog also need a hand check.

🤖 Generated with Claude Code

enowdev and others added 2 commits November 10, 2026 08:16
A saved host can be left unconnected when the app starts, until the user
opens it (hosts.Host.NoStartConnect). It is on for every host, those
already saved included, in Hosts › Edit… and when adding one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: enowdev <enowdev@gmail.com>
The app already watched every host it didn't show, but a host signed in
to by password waited for the user: its watch never read the keychain, so
it connected only once the user switched to it and typed or unlocked the
password, and only then did its sessions show. A watch now reads a saved
password once per run, and a host it can't get one for waits as before.
A watch's connecting gives up after 2 minutes, so a host that doesn't
answer reads offline and is tried later; one offline is tried again at
once when the window comes back or the machine wakes from sleep. A host
with Connect at start off is watched only once the user opened it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: enowdev <enowdev@gmail.com>
@enowdev
enowdev merged commit 4e17f62 into main Nov 10, 2026
3 of 4 checks passed
@enowdev
enowdev deleted the feat/auto-connect-hosts branch November 10, 2026 20:02
@enowdev enowdev mentioned this pull request Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant