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

@@ -2320,6 +2320,7 @@ export class AgentSession {
}): void {
const autoResizeImages = this.settingsManager.getImageAutoResize();
const shellCommandPrefix = this.settingsManager.getShellCommandPrefix();
const shellPath = this.settingsManager.getShellPath();
const baseToolDefinitions = this._baseToolsOverride
? Object.fromEntries(
Object.entries(this._baseToolsOverride).map(([name, tool]) => [
@@ -2329,7 +2330,7 @@ export class AgentSession {
)
: createAllToolDefinitions(this._cwd, {
read: { autoResizeImages },
bash: { commandPrefix: shellCommandPrefix },
bash: { commandPrefix: shellCommandPrefix, shellPath },
});
this._baseToolDefinitions = new Map(
@@ -2551,13 +2552,14 @@ export class AgentSession {
// Apply command prefix if configured (e.g., "shopt -s expand_aliases" for alias support)
const prefix = this.settingsManager.getShellCommandPrefix();
const shellPath = this.settingsManager.getShellPath();
const resolvedCommand = prefix ? `${prefix}\n${command}` : command;
try {
const result = await executeBashWithOperations(
resolvedCommand,
this.sessionManager.getCwd(),
options?.operations ?? createLocalBashOperations(),
options?.operations ?? createLocalBashOperations({ shellPath }),
{
onChunk,
signal: this._bashAbortController.signal,