[Bug]: SSH connect takes ~95s on high-latency links
Operating system
macOS
Orca version
v1.4.142
Details
Details:
Short summary
Connecting to an SSH host takes ~95 seconds on a ~150ms RTT link, even when the relay is already installed on the remote. Per-step timing shows the time is not spent in the SSH handshake or relay deploy. It is almost entirely the managed agent-hook install, which runs 16 per-agent installers serially, each paying its own chain of SFTP round trips on every connect.
Measurements
Instrumented a cold connect (warm relay, Linux x86_64 remote, ~150ms RTT):
| Step | Duration |
|---|---|
| Relay deploy (probe + attach, already installed) | ~2.1s |
| Relay health check | 0.15s |
registerRelayRoots |
~0s |
| Plugin install (mux RPC) | 0.3s |
| Remote orca CLI launcher install | 1.8s |
| Managed agent-hook install (16 installers, serial SFTP) | 93.5s |
| Total until connected | ~97s |
Each installer does its own mkdirp walk, script read/write, and config read/write over SFTP. At ~150ms per round trip, 16 serial installer chains add up to hundreds of sequential round trips. The cost repeats on every connect, not just the first one.
A secondary, smaller factor: the renderer only issues ssh:connect after its full hydration chain (settings, repos, session stores), so the SSH handshake and relay bring-up serialize behind renderer startup instead of overlapping it.
Reproduction steps
- Add an SSH host with a round-trip latency of ~100ms or more (any cross-region VPS works).
- Connect once so the relay is installed.
- Quit and reopen Orca (or disconnect/reconnect).
- Time how long the host takes to reach "connected". With
ORCA_STARTUP_DIAGNOSTICS=1, the gap is visible between the relay health check and provider registration completing.
Additional context
- I have a patch ready that runs the installers concurrently (93.5s → 11.0s measured) and overlaps the reconnect with renderer hydration (~97s → ~19s total); PR to follow.