From 7f24a132d0ec49ba309554c046f5a311e9cda070 Mon Sep 17 00:00:00 2001 From: Aamer Akhter Date: Sat, 13 Jun 2026 10:29:56 -0400 Subject: [PATCH] COD-104 fix: skip remote tmux prereq check under VITEST (test-mode) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit COD-104 wired checkRemoteTmuxAvailable into the remote-session create path, but it does a real `ssh` via exec — so 2 remote-create tests in session-routes.test.ts hit a ~10s ssh timeout and failed (422). Mirror TmuxManager's IS_TEST_MODE no-op-shell-under-VITEST: short-circuit the live probe to {ok:true} under vitest. Command construction stays covered by buildRemoteTmuxCheckCommand unit tests. session-routes.test.ts now 61/61. Co-Authored-By: Claude Opus 4.8 (1M context) (cherry picked from commit 6ae2c0b8160090a1f0f6b32a3fe8496d402ac2c6) --- src/remote-hosts.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/remote-hosts.ts b/src/remote-hosts.ts index dbf82cff..7e5d7252 100644 --- a/src/remote-hosts.ts +++ b/src/remote-hosts.ts @@ -173,6 +173,14 @@ export interface RemoteTmuxCheckResult { export async function checkRemoteTmuxAvailable( host: Pick & RemoteSshOptions ): Promise { + // Under vitest, never open a real ssh connection — mirrors TmuxManager's + // no-op-shell-under-VITEST (IS_TEST_MODE). Without this, remote-case + // create-path tests hit a real ~10s ssh timeout. The command construction is + // covered by buildRemoteTmuxCheckCommand unit tests; only the live probe is + // short-circuited here. + if (process.env.VITEST) { + return { ok: true, tmuxPath: '(test-mode)' }; + } const command = buildRemoteTmuxCheckCommand(host); try { const { stdout } = await execAsync(command, { timeout: 15_000 });