fix(coding-agent): preserved bash status while syncing cwd

Propagated the native shell working directory in ShellRunResult so AgentSession can refresh cwd without running a hidden pwd command in the persistent shell.

Added regression coverage for cd plus a failing command followed by echo $?, proving cwd sync no longer overwrites the user's last shell status.

Fixes #3958
This commit is contained in:
roboomp
2026-07-01 02:27:05 +00:00
parent 66a9667cc1
commit dff941d5fe
8 changed files with 64 additions and 60 deletions
@@ -51,6 +51,7 @@ export interface BashResult {
outputLines: number;
outputBytes: number;
artifactId?: string;
workingDir?: string;
}
const shellSessions = new Map<string, Shell>();
@@ -429,6 +430,7 @@ export async function executeBash(command: string, options?: BashExecutorOptions
return {
exitCode: winner.result.exitCode,
cancelled: false,
workingDir: winner.result.workingDir,
...(await sink.dump()),
};
} catch (err) {