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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(ssh): a throwing tunnel-verified hook can no longer fail the connect
enes4d2fde8db8c9
diff --git a/src/main/remote-ssh/ssh-project.test.ts b/src/main/remote-ssh/ssh-project.test.tsindex f2709d1e5..c23b7bd4a 100644--- a/src/main/remote-ssh/ssh-project.test.ts+++ b/src/main/remote-ssh/ssh-project.test.ts@@ -818,6 +818,20 @@ describe('SshProjectManager', () => {await mgr.connect('p1', conn, '/remote/cwd')expect(onTunnelVerified).not.toHaveBeenCalled()})++ it('a THROWING hook still leaves the connect successful — the resync is never load-bearing', async () => {+ // The contract is structural, not a property of today's callback: what this hook drives will+ // grow, and a throw inside it must never surface to the user as a dead SSH project. Same rule+ // as `onStatus` above, which used to abort connect() mid-flight.+ const mgr = makeVerifiedMgr(() => {+ throw new Error('resync blew up')+ })+ const res = await mgr.connect('p1', conn, '/remote/cwd')+ expect(res.controlPath).toBe(controlPathFor('p1'))+ // Everything AFTER the hook still ran: the connect result is complete, not truncated.+ expect(res.hookEndpointPath).toBe('/home/u/.nodeterm/hook-endpoint-p1.env')+ expect(res.remoteHome).toBe('/home/u')+ })})// --- concurrent connect for one project ---------------------------------------------------diff --git a/src/main/remote-ssh/ssh-project.ts b/src/main/remote-ssh/ssh-project.tsindex 05b39dd61..21662723e 100644--- a/src/main/remote-ssh/ssh-project.ts+++ b/src/main/remote-ssh/ssh-project.ts@@ -526,7 +526,18 @@ export class SshProjectManager {// before this line), so this is exactly the moment the hook events lost while it was down// can be reconstructed from the host. Fire-and-forget: the resync runs several remote round// trips and must never delay (or fail) the connect that is already reporting `connected`.- if (hookEndpointPath) this.r.onTunnelVerified?.(projectId, controlPath)+ // The try/catch is the contract, not politeness: what this hook drives will grow, and a+ // throw inside it would surface to the user as a dead SSH project — the connect fails, the+ // entry is left half-built, and the reason is a repair job that was only ever best-effort.+ // A resync must never cost the user the connection that is already reporting `connected`.+ // (`onStatus` above carries the same guard for the same hard-won reason.) Do not tidy away.+ if (hookEndpointPath) {+ try {+ this.r.onTunnelVerified?.(projectId, controlPath)+ } catch {+ // undecided changes nothing: the stale sweep remains the backstop, as before this hook+ }+ }// Resolve the remote $HOME once and retain it (the hook setup above also learns it but// doesn't surface it). Phase 2b uses it to jail remote transcript reads. Fail-open: an// unresolved home just disables the remote context meter / subagent transcript / search.