The best way to control Claude Code, Codex and more from any computer or phone
fix(ssh): distinguish incompatible Node from a missing executable (#35607)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Mason committed
Nov 12, 2026 at 16:51 UTC
beaa647dc16d053e10c62780a3dc190c078a5216
2 files changed
+53
-1
packages/ssh/src/tunnel.test.ts
+50
@@ -170,6 +170,56 @@ const localRemoteShellLayer = (home: string) =>
170
);
171
172
describe("ssh tunnel scripts", () => {
173
+ it.live("distinguishes an incompatible remote Node from a missing executable", () =>
174
+ Effect.gen(function* () {
175
+ const fs = yield* FileSystem.FileSystem;
176
+ const home = yield* fs.makeTempDirectoryScoped({ prefix: "t3-ssh-node-" });
177
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
178
+ for (const missing of [false, true]) {
179
+ const nodeFixture = missing
180
+ ? "command() { return 1; }; "
181
+ : 'node() { cat >/dev/null; printf "Remote node 18.20.8 does not satisfy required range >=999.0.0.\\n" >&2; return 1; }; ';
182
+ const remoteShell = ChildProcessSpawner.make((command) => {
183
+ if (command._tag !== "StandardCommand") return spawner.spawn(command);
184
+ return spawner.spawn(
185
+ ChildProcess.make(
186
+ "sh",
187
+ ["-c", `${nodeFixture}eval "$(cat)"`, "sh", ...commandArgs(command).slice(-1)],
188
+ {
189
+ ...command.options,
190
+ env: {
191
+ ...command.options.env,
192
+ HOME: home,
193
+ NVM_DIR: NodePath.join(home, ".nvm"),
194
+ FNM_DIR: NodePath.join(home, ".fnm"),
195
+ VOLTA_HOME: NodePath.join(home, ".volta"),
196
+ },
197
+ },
198
+ ),
199
+ );
200
+ });
201
+ const result = yield* SshTunnel.launchOrReuseRemoteServer(
202
+ { alias: "devbox", hostname: "devbox", username: null, port: null },
203
+ undefined,
204
+ { nodeScriptPath: "/unused/server.ts", nodeEngineRange: ">=999.0.0" },
205
+ ).pipe(
206
+ Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, remoteShell),
207
+ Effect.result,
208
+ );
209
+ assert.isTrue(Result.isFailure(result));
210
+ if (!Result.isFailure(result)) return;
211
+ assert.isTrue(isSshCommandError(result.failure));
212
+ if (!isSshCommandError(result.failure)) return;
213
+ assert.equal(result.failure.exitCode, 1);
214
+ assert.equal(result.failure.stderr.includes("missing node on PATH"), missing);
215
+ assert.equal(
216
+ result.failure.stderr.includes("does not satisfy required range >=999.0.0"),
217
+ !missing,
218
+ );
219
+ }
220
+ }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
221
+ );
222
+
223
it("rejects archive versions that are not a single exact version segment", () => {
224
for (const archiveVersion of [
225
"../other",
packages/ssh/src/tunnel.ts
+3
-1
@@ -604,7 +604,9 @@ if [ "$T3_ARCHIVE_MODE" = "1" ]; then
604
# archive before the port and readiness probes rely on it.
605
"$RUNNER_NEXT" --version >/dev/null
606
elif ! ensure_remote_node_path; then
607
- printf 'Remote host is missing node on PATH. Install Node or configure a supported version manager for non-interactive shells.\\n' >&2
607
+ if ! command -v node >/dev/null 2>&1; then
608
+ printf 'Remote host is missing node on PATH. Install Node or configure a supported version manager for non-interactive shells.\\n' >&2
609
+ fi
610
exit 1
611
fi
612
# Recovery runs under its own lock and re-reads the owner there, so a waiter