Skip to content

feat(ssh): add a setting to stop connecting to remote hosts automatically - #3

Open
decrypted wants to merge 7 commits into
feat/port-detection-settingfrom
feat/remote-autoconnect-setting
Open

decrypted wants to merge 7 commits into
feat/port-detection-settingfrom
feat/remote-autoconnect-setting

Conversation

@decrypted

@decrypted decrypted commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #2 (the port-detection PR) (it adds a row to the same Background activity group).

What

Connect to remote hosts automatically (remoteHostAutoConnectEnabled, default on).

When off, every SSH host, and every remote server reached through one, is held until the user explicitly connects. This reuses the existing per-host "Reconnect on launch" hold, so the following stop for held hosts:

  • status probes and their 3/6/12/30/60 s retry loop
  • managed tunnels and deploys
  • passive RPCs, including port scans (held servers are left out of the scanner)
  • the startup restore

A host the user connected keeps the existing bounded redial ladder after a drop. When its session ends (reconnection-failed, error, auth-failed, disconnected), it is held again, so the forever-retry cannot come back.

Runtime toggle:

  • ON→OFF holds only hosts without an open session.
  • OFF→ON lifts only the holds the setting made. An explicit Disconnect and per-host opt-outs stay held.

Why

With unreachable remote runtimes configured, Orca spawned ssh <host> echo ORCA-SYSTEM-SSH-OK (twice per try) for every environment every 60 s, forever.

Testing

  • oxlint, oxfmt, pnpm tc, localization checks, and tests for main ssh, ipc/ssh and runtime-environments on box.
  • Tests added in the existing ssh-user-disconnect / ssh-host-user-disconnect harnesses: the setting lifts only its own holds; a terminal state while off holds the host again.
  • Performance review: held hosts have no timers and spawn nothing; the settings listener is O(1) for unrelated writes.

Risk

Medium.

  • Touches connect, hold and lift paths. Explicit connects were verified to go through the non-automatic path that lifts the hold.
  • Not covered: servers paired directly over LAN or Tailscale (no SSH route) still retry.

🤖 Generated with Claude Code

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​85 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​84
Prod 24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​544 $\color{#cf222e}{\Huge{\mathbf{−}}}$​59 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​485

@decrypted
decrypted force-pushed the feat/remote-autoconnect-setting branch from b70c077 to 630eb34 Compare November 16, 2026 10:24
@decrypted
decrypted force-pushed the feat/port-detection-setting branch from 305526e to f714b3b Compare November 17, 2026 08:39
@decrypted
decrypted force-pushed the feat/remote-autoconnect-setting branch from 630eb34 to 3800425 Compare November 17, 2026 08:39
@decrypted
decrypted force-pushed the feat/port-detection-setting branch from f714b3b to 14f67a6 Compare November 18, 2026 08:42
@decrypted
decrypted force-pushed the feat/remote-autoconnect-setting branch from 3800425 to 0da1bbd Compare November 18, 2026 08:42
decrypted added a commit that referenced this pull request Nov 18, 2026
Upstream 8abbc91..2f5abbc (245 commits). Branches rebased onto it:
fix/linux-port-scan-inode-cache (#1; now on upstream's linux-proc-net-listeners
parser, which gained a uid field), feat/port-detection-setting (#2),
feat/remote-autoconnect-setting (#3), feat/reduce-motion-setting (#4),
feat/keep-awake-timed (#5), feat/sleep-project-and-group (#6),
feat/project-group-filter (#7; group hider composed over upstream's
folder-nested exemption), fix/worktree-create-missing-base-hint (#8), ci/fork-build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@decrypted
decrypted force-pushed the feat/port-detection-setting branch from 14f67a6 to 098b448 Compare November 19, 2026 08:18
@decrypted
decrypted force-pushed the feat/remote-autoconnect-setting branch from 0da1bbd to 74de28d Compare November 19, 2026 08:18
decrypted added a commit that referenced this pull request Nov 19, 2026
Upstream 2f5abbc..7bc705a (345 commits). Branches rebased onto it:
#1 fix/linux-port-scan-inode-cache, #2 feat/port-detection-setting, #3 feat/remote-autoconnect-setting,
#4 feat/reduce-motion-setting, #5 feat/keep-awake-timed, #6 feat/sleep-project-and-group,
#7 feat/project-group-filter, #8 fix/worktree-create-missing-base-hint; plus ci/fork-build.

- #2: upstream stablyai#43836 took the refreshing flag away from the background scanner; the
  detection-off reset no longer clears it.
- #4: upstream's HoverScrollText and the composer glow use the motion-safe / motion-reduce
  variants; the bot activity list scrolls with motionSafeScrollBehavior.
- #7: kept upstream's bot-listed workspace exclusion next to the project-group scope.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@decrypted
decrypted force-pushed the feat/port-detection-setting branch from 098b448 to f71a6b7 Compare November 20, 2026 08:21
@decrypted
decrypted force-pushed the feat/remote-autoconnect-setting branch from 74de28d to df7acc3 Compare November 20, 2026 08:22
@decrypted
decrypted force-pushed the feat/port-detection-setting branch from f71a6b7 to 4cc6ddd Compare November 23, 2026 08:19
@decrypted
decrypted force-pushed the feat/remote-autoconnect-setting branch from df7acc3 to f4b00dc Compare November 23, 2026 08:19
decrypted added a commit that referenced this pull request Nov 23, 2026
Upstream 3df243e..0b23e7a (1046 commits). Tree verified on the scratch
integration branch: tc and check:changed (42 checks) green.

- follow the upstream test cut (stablyai#46786): drop test-only reset exports and
  edits to deleted tests (#3)
- #4: upstream's new reduced-motion CSS/matchMedia moved onto the setting
- #5: union with upstream's WSL-host keep-awake counts; option types moved
  out for max-lines
- #7: hiddenProjectGroupIds moved into ClientUiWorkspaceFilterFields (max-lines)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@decrypted
decrypted force-pushed the feat/port-detection-setting branch from 4cc6ddd to c7554ae Compare November 24, 2026 08:13
@decrypted
decrypted force-pushed the feat/remote-autoconnect-setting branch 2 times, most recently from 32fb4d3 to faa6541 Compare November 25, 2026 08:11
@decrypted
decrypted force-pushed the feat/port-detection-setting branch from c7554ae to 3b0811f Compare November 25, 2026 08:11
decrypted added a commit that referenced this pull request Nov 25, 2026
Rebase conflicts were sibling additions only: locale blocks (#2 en.json,
#5 tr.json), main.css next to upstream's forced-colors plugin icon rule (#4),
and #3's launch hold next to upstream's retireStateOfRemovedEnvironments.
#4 keeps routing BotItemReplyJump through readPrefersReducedMotion().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@decrypted
decrypted force-pushed the feat/port-detection-setting branch from 3b0811f to e76327e Compare November 26, 2026 08:08
@decrypted
decrypted force-pushed the feat/remote-autoconnect-setting branch from faa6541 to d74f555 Compare November 26, 2026 08:08
decrypted added a commit that referenced this pull request Nov 26, 2026
Upstream 2bd7ae3 -> 0fce80c (284 commits). Drops the stablyai#48819 carry
(fix/upstream-48819-mcp-sdk-bundle): upstream merged it as 346447d.

- #4: native-chat-markdown.css word fade split upstream (color vs
  opacity), Reduce motion guard on both rules; BotItemReplyJump.tsx
  removed by upstream's revert of stablyai#48081, our edit dropped; new raw
  prefers-reduced-motion block in terminal.css moved onto motion-reduce.
- #2 en.json sibling union; global-settings-base.ts import union (#2/#3
  vs #4).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@decrypted
decrypted force-pushed the feat/port-detection-setting branch from e76327e to 943cb05 Compare November 27, 2026 08:13
@decrypted
decrypted force-pushed the feat/remote-autoconnect-setting branch from d74f555 to 80e734d Compare November 27, 2026 08:13
decrypted and others added 6 commits November 30, 2026 11:52
…ally

With SSH hosts configured, Orca keeps dialing them in the background
even when they are not in use: the server status owners retry every
60 s per environment, each retry spawning ssh, and the renderer restores
every host that was live at quit.

Add `remoteHostAutoConnectEnabled` (default on) to Settings > Advanced >
Background activity. When off, every SSH host (runtime-owned VM hosts
excepted) is held like a host with "Reconnect on launch" off: the user
disconnect hold refuses every background dial (status probes, managed
tunnels, deploys, RPCs, wake/online retries) and the servers reached
through it are held manually disconnected, until the user connects it.
An explicit Connect lifts the hold as before, and a host the user
connected keeps its reconnect-after-drop behaviour.

- launch: the once-per-process launch hold holds every host, and the
  renderer skips its startup SSH restore
- turning it off holds hosts with no open session, closes their failed
  sessions and retires their servers' status owners; live sessions stay
- turning it on lifts only the holds the setting made, never a user
  Disconnect or a per-host launch opt-out, and resumes those servers
- hosts added or imported while it is off start held

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… is off

With automatic connects off, a host the user connected kept its hold
lifted for good: once its session ended and the reconnect ladder gave
up, the servers reached through it went back to retrying every 60 s,
each retry spawning ssh, and wake/unlock restarted the ladder.

- when a session reaches disconnected, error, auth-failed or
  reconnection-failed while the setting is off, hold the host and its
  servers again (on the state transition, so no steady-state cost); the
  bounded redial ladder after a drop still runs first
- only user connects are exempt: `connectTarget` attempts now record
  whether they are automatic (a user's connect joining one clears it),
  and a server's Connect marks its SSH host as user-connecting while it
  dials; the old session a dial replaces does not count as an end
- servers held at launch get a retired status owner like servers held
  later, and the port scanner skips servers whose owner is retired, so
  held servers get no 30 s scan RPC until they connect again
- adding or importing a host only builds the hold bookkeeping while the
  setting is off

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every read goes through isRemoteHostAutoConnectEnabled(), which treats
an absent value as on, so the explicit default only added a line to
default-global-settings.ts, which the settings branches together push
over its max-lines limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Orca servers

The switch lived only in Advanced > Background activity, away from the
hosts it governs. Show the same setting at the top of Remote Orca
servers too (desktop only, as the setting is desktop-local), from one
shared row component and one search entry, so search finds it in both
places.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SSH hosts is where per-host "Reconnect on launch" lives, so show the
global switch at the top of that section too, from the same shared row
and search entry, and say in the per-host help that turning the global
switch off does the same for every host.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… hosts down fully

Review fixes for automatic connects turned off:

- Set up Orca on a host, converting a host to a managed server, and
  Update/Rollback/Recover/Restart dialed through the hold and failed
  with "<host> was disconnected". They now lift the host's holds like
  Connect does and run as a user connect, so their own session changes
  do not hold the host again mid-action; lifted servers resume after.
- An explicit Connect runs as a user connect from its lift on, so a
  queued teardown cannot hold the host before the attempt registers;
  a Connect that fails holds the host again before its servers resume.
- A newly held host gets the full Disconnect teardown (connect attempt,
  host server status, port forwards, managed tunnels) instead of a
  bare session close, so system-SSH forwards and tunnels do not
  outlive the hold, e.g. on Windows without ControlMaster.
- The paired `ssh.connect` RPC passes the hold refusal through, so web
  clients see the host as held rather than as a failed connection.
- Hosts held by the setting say so instead of "was disconnected".
- The switch rows hide while there are no user SSH hosts, and the copy
  says directly paired servers are unaffected and no longer implies
  that turning it on reconnects everything.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Upstream removed every test-only reset export with the test-suite cut
(stablyai#46786); the tests that used this one went with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@decrypted
decrypted force-pushed the feat/port-detection-setting branch from 943cb05 to 9da53f1 Compare November 30, 2026 11:09
@decrypted
decrypted force-pushed the feat/remote-autoconnect-setting branch from 80e734d to b8d7009 Compare November 30, 2026 11:09
decrypted pushed a commit that referenced this pull request Nov 30, 2026
…e share a name (stablyai#52701)

Check runs were keyed by suite and name, so two same-named runs in one
suite shared one saved row. Every poll one of them carried a different run
id than the saved row and read as a rerun, posting a new "CI green" line
for the same head. Sort observed runs by run id and suffix repeated names
(#2, #3) so each run keeps its own row and an unchanged read compares equal.

Fixes stablyai#52700

Co-authored-by: Neil <[email protected]>
decrypted added a commit that referenced this pull request Nov 30, 2026
Upstream a788fad..9fa1d98 (1236 commits). Branches: #2 port detection,
#3 remote auto-connect, #4 reduce motion, #5 keep-awake (squashed to one commit), #6 project sleep,
#7 project-group filter, #8 base-branch hint, #9 mouse history buttons (new in local/build), ci/fork-build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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