fix(ssh): restore user PATH for remote servers (#7213)

This commit is contained in:
Guilherme Barros authored and GitHub committed 2026-08-22 16:00:21 -04:00
1 parent 2c4158f87a
commit 49c2b4471c
5 files changed
+13 -14

No files matched your search

@@ -862,7 +862,7 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
status: "error",
auth: { status: "unknown" },
message: isCommandMissingCause(error)
? "Claude Agent CLI (`claude`) is not installed or not on PATH."
? "Claude Agent CLI (`claude`) was not found on PATH."
: "Failed to execute Claude Agent CLI health check.",
},
});
@@ -576,7 +576,7 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu
auth: { status: "unknown" },
message: installed
? `Codex app-server provider probe failed: ${error.message}.`
: "Codex CLI (`codex`) is not installed or not on PATH.",
: "Codex CLI (`codex`) was not found on PATH.",
},
});
}
@@ -494,10 +494,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsModule.layerTest(), Te
assert.strictEqual(status.status, "error");
assert.strictEqual(status.installed, false);
assert.strictEqual(status.auth.status, "unknown");
assert.strictEqual(
status.message,
"Codex CLI (`codex`) is not installed or not on PATH.",
);
assert.strictEqual(status.message, "Codex CLI (`codex`) was not found on PATH.");
}),
);
@@ -1462,7 +1459,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsModule.layerTest(), Te
assert.strictEqual(codexPersonal?.installed, false);
assert.strictEqual(
codexPersonal?.message,
"Codex CLI (`codex`) is not installed or not on PATH.",
"Codex CLI (`codex`) was not found on PATH.",
);
}).pipe(Effect.provide(runtimeServices));
}),
@@ -2252,10 +2249,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsModule.layerTest(), Te
assert.strictEqual(status.status, "error");
assert.strictEqual(status.installed, false);
assert.strictEqual(status.auth.status, "unknown");
assert.strictEqual(
status.message,
"Claude Agent CLI (`claude`) is not installed or not on PATH.",
);
assert.strictEqual(status.message, "Claude Agent CLI (`claude`) was not found on PATH.");
}).pipe(Effect.provide(failingSpawnerLayer("spawn claude ENOENT"))),
);
+7 -2
View File
@@ -243,8 +243,12 @@ describe("ssh tunnel scripts", () => {
username: "julius",
port: 2222,
} as const;
const spawner = ChildProcessSpawner.make(() =>
Effect.succeed(makeSuccessfulProcess('loaded nvm default\n{"remotePort":3774}\n')),
const spawnedCommands: Array<ReadonlyArray<string>> = [];
const spawner = ChildProcessSpawner.make((command) =>
Effect.sync(() => {
spawnedCommands.push(commandArgs(command));
return makeSuccessfulProcess('loaded nvm default\n{"remotePort":3774}\n');
}),
);
const spawnerLayer = Layer.succeed(ChildProcessSpawner.ChildProcessSpawner, spawner);
const processLayer = Layer.merge(NodeServices.layer, spawnerLayer);
@@ -252,6 +256,7 @@ describe("ssh tunnel scripts", () => {
return Effect.gen(function* () {
const result = yield* launchOrReuseRemoteServer(target);
assert.equal(result.remotePort, 3774);
assert.deepEqual(spawnedCommands[0]?.slice(-5, -1), ["sh", "-l", "-s", "--"]);
}).pipe(Effect.provide(processLayer));
});
+1 -1
View File
@@ -724,7 +724,7 @@ export const launchOrReuseRemoteServer = Effect.fn("ssh/tunnel.launchOrReuseRemo
stateKey: remoteStateKey(target),
});
const result = yield* runSshCommand(target, {
remoteCommandArgs: ["sh", "-s", "--", remoteStateKey(target)],
remoteCommandArgs: ["sh", "-l", "-s", "--", remoteStateKey(target)],
stdin: buildRemoteLaunchScript(runner),
timeoutMs: REMOTE_LAUNCH_TIMEOUT_MS,
...(input?.authSecret === undefined ? {} : { authSecret: input.authSecret }),