From 4c1362884dcb560fd20230881f39f9b1f824a088 Mon Sep 17 00:00:00 2001 From: WuTianyi123 <276886827+WuTianyi123@users.noreply.github.com> Date: Mon, 20 Apr 2026 19:01:14 +0800 Subject: [PATCH] fix(local): respect configured cwd in init_session() LocalEnvironment._run_bash() spawned subprocess.Popen without a cwd argument, so init_session()'s pwd -P ran in the gateway process's startup directory and overwrote self.cwd. Pass cwd=self.cwd so the initial snapshot captures the user-configured working directory. Tested: - pytest tests/ -q (255 env-related tests passed) - Full suite: 13,537 passed; 70 pre-existing failures unrelated to local env --- tools/environments/local.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/environments/local.py b/tools/environments/local.py index 06fd66a2d..e4ef27829 100644 --- a/tools/environments/local.py +++ b/tools/environments/local.py @@ -349,6 +349,7 @@ class LocalEnvironment(BaseEnvironment): stderr=subprocess.STDOUT, stdin=subprocess.PIPE if stdin_data is not None else subprocess.DEVNULL, preexec_fn=None if _IS_WINDOWS else os.setsid, + cwd=self.cwd, ) if stdin_data is not None: