From 835bab5f5a65f2be0cf0239a26d4d1f40a0be5cd Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Thu, 21 May 2026 16:06:52 +0800 Subject: [PATCH] fix(exec): stabilize Windows shell tests --- nanobot/agent/tools/shell.py | 3 ++- tests/tools/test_exec_session_tools.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/nanobot/agent/tools/shell.py b/nanobot/agent/tools/shell.py index 25fbff50c..537c89343 100644 --- a/nanobot/agent/tools/shell.py +++ b/nanobot/agent/tools/shell.py @@ -414,7 +414,8 @@ class ExecTool(Tool): ) shell_program = shell_program or shutil.which("bash") or "/bin/bash" args = [shell_program] - if login and Path(shell_program).name in {"bash", "zsh"}: + shell_name = Path(shell_program).name.lower() + if login and shell_name in {"bash", "bash.exe", "zsh", "zsh.exe"}: args.append("-l") args.extend(["-c", command]) return await asyncio.create_subprocess_exec( diff --git a/tests/tools/test_exec_session_tools.py b/tests/tools/test_exec_session_tools.py index 76b3c9781..f5fe45e96 100644 --- a/tests/tools/test_exec_session_tools.py +++ b/tests/tools/test_exec_session_tools.py @@ -37,7 +37,10 @@ def test_exec_keeps_one_shot_behavior_without_yield_time_ms(tmp_path): def test_exec_accepts_command_aliases(tmp_path): async def run() -> str: tool = ExecTool(working_dir="/") - return await tool.execute(cmd="pwd", workdir=str(tmp_path)) + return await tool.execute( + cmd=_python_command("import os; print(os.getcwd())"), + workdir=str(tmp_path), + ) result = asyncio.run(run())