fix(coding-agent): resolve shell config from session settings

Stop shell resolution from consulting ambient process.cwd() during bash execution and use the active session's shellPath setting instead.

closes #3452
This commit is contained in:
Mario Zechner
2026-04-20 22:32:11 +02:00
parent 5a4e22ea44
commit c40efa9bab
5 changed files with 48 additions and 34 deletions

View File

@@ -409,6 +409,28 @@ describe("Coding Agent Tools", () => {
await expect(bashWithBadShell.execute("test-call-12", { command: "echo test" })).rejects.toThrow(/ENOENT/);
});
it("should pass shellPath through to shell resolution", async () => {
const getShellConfigSpy = vi.spyOn(shellModule, "getShellConfig");
const bashWithCustomShell = createBashTool(testDir, {
shellPath: "/custom/bash",
operations: {
exec: async () => ({ exitCode: 0 }),
},
});
await bashWithCustomShell.execute("test-call-12b", { command: "echo test" });
expect(getShellConfigSpy).not.toHaveBeenCalled();
const ops = createLocalBashOperations({ shellPath: "/custom/bash" });
await expect(
ops.exec("echo test", testDir, {
onData: () => {},
}),
).rejects.toThrow("Custom shell path not found: /custom/bash");
expect(getShellConfigSpy).toHaveBeenCalledWith("/custom/bash");
});
it("should prepend command prefix when configured", async () => {
const bashWithPrefix = createBashTool(testDir, {
commandPrefix: "export TEST_VAR=hello",