Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(ssh): accept a first-seen host key instead of aborting the connection

enes1d47af424565
diff --git a/src/core/remote-ssh/control-master.test.ts b/src/core/remote-ssh/control-master.test.ts
index 9e0c7f5d5..a9d79fca5 100644
--- a/src/core/remote-ssh/control-master.test.ts
+++ b/src/core/remote-ssh/control-master.test.ts
@@ -28,6 +28,7 @@ const childPrefix = [
'-o', 'ControlMaster=auto',
'-o', 'ControlPath=/s.sock',
'-o', 'ControlPersist=300',
+ '-o', 'StrictHostKeyChecking=accept-new',
'-o', 'ServerAliveInterval=15',
'-o', 'ServerAliveCountMax=4',
'-p', '2222',
@@ -65,6 +66,7 @@ describe('masterArgs', () => {
'-o', 'ControlPath=/ud/ssh-cm/p.sock',
'-o', 'ControlPersist=300',
'-o', 'BatchMode=no',
+ '-o', 'StrictHostKeyChecking=accept-new',
'-o', 'ServerAliveInterval=15',
'-o', 'ServerAliveCountMax=4',
'-p', '2222',
diff --git a/src/core/remote-ssh/control-master.ts b/src/core/remote-ssh/control-master.ts
index 4d04a7328..59e14abc0 100644
--- a/src/core/remote-ssh/control-master.ts
+++ b/src/core/remote-ssh/control-master.ts
@@ -46,6 +46,13 @@ export function masterArgs(conn: SshConnection, controlPath: string): string[] {
'ControlPersist=300',
'-o',
'BatchMode=no',
+ // Unknown host → record it and connect, instead of aborting. The master is backgrounded
+ // (`-M -N`, no tty), so the default `StrictHostKeyChecking=ask` can never get its yes/no
+ // answered and the whole connection fails — the "server not in known_hosts" error users hit.
+ // `accept-new` auto-accepts a FIRST-SEEN host key (writing it to known_hosts) but STILL
+ // refuses a host whose recorded key later CHANGED, so MITM protection on known hosts stays.
+ '-o',
+ 'StrictHostKeyChecking=accept-new',
// Keepalives on the ONE connection every terminal multiplexes over: keep NAT/firewall
// entries warm, and detect a dead link in ~60s (15s × 4) instead of hanging half-dead
// after sleep/wake or a network change. The client then exits 255 and the renderer's
@@ -83,6 +90,11 @@ export function childArgs(conn: SshConnection, controlPath: string, remote?: str
`ControlPath=${controlPath}`,
'-o',
'ControlPersist=300',
+ // Matters when this child is the one that actually touches the host (it became the master, or
+ // fell back to a direct connection because the master was gone): a first-seen host key must be
+ // recorded and accepted rather than abort a backgrounded, tty-less exec. See masterArgs.
+ '-o',
+ 'StrictHostKeyChecking=accept-new',
// Meaningful only when this child ends up owning the transport (became the master, or fell
// back to a direct connection) — a mux client rides the master's keepalives. Same values as
// masterArgs, for the same reason: detect a dead link in ~60s instead of hanging half-dead.