agentscope-ai / agentscope-ai/agentscope

[Bug]: three tests fail on Windows dev machines without Git usr/bin on PATH (POSIX shell tool dependency)

未关闭
#2,608 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
31.6k
派生
3.5k
平均合并
1 天 16 小时
30 天内合并 PR
103

描述

- [x] I have searched the existing [issues](https://github.com/agentscope-ai/agentscope/issues) and [discussions](https://github.com/agentscope-ai/agentscope/discussions), and this is not a duplicate.
- [x] This is a bug, not a usage question. (For questions, please use [Discussions](https://github.com/agentscope-ai/agentscope/discussions/new?category=general) instead.)

### Background / Description

Three tests fail on a stock Windows dev machine where Git''s `usr/bin` (POSIX coreutils: `mv`, `mkdir`, `test`, `rm`) is not on `PATH`:

```
FAILED tests/workspace_skill_archive_test.py::AddSkillArchiveSandboxedTest::test_directory_name_is_suffixed_when_taken
FAILED tests/workspace_skill_archive_test.py::AddSkillArchiveSandboxedTest::test_flat_archive_is_accepted
FAILED tests/workspace_daytona_test.py::TestDaytonaWorkspaceBuiltinToolsMock::test_offload_context_tool_result_and_reset
```

Both clusters depend on POSIX shell tools being executable on the *host*:

1. `AddSkillArchiveSandboxedTest` deliberately exercises the base `WorkspaceBase.add_skill_archive` implementation over a `LocalBackend`. That base implementation is written for POSIX sandboxes and shells out to `mkdir -p` / `mv` (`src/agentscope/workspace/_base.py`), which do not exist on stock Windows — `LocalBackend.exec_shell` spawns programs directly without a shell. (`LocalWorkspace.add_skill_archive` itself is overridden and its own test class passes; only the base-implementation-over-local-backend tests fail.)

2. `test_offload_context_tool_result_and_reset` runs through the "host-backed Daytona fake" (`_MappedProcess`), which re-executes sandbox shell commands (`test -e`, `mkdir -p`, `rm -rf`) on the host via `asyncio.create_subprocess_shell` — i.e. `cmd.exe` on Windows, where these commands do not exist.

These pass on `windows-latest` CI because the runner image puts Git''s `usr/bin` on `PATH`, so `mv.exe`/`test.exe`/etc. resolve. On a dev machine without that on `PATH` (e.g. Git installed elsewhere, or only `Git/cmd` on `PATH`), they fail. The repo already acknowledges this class of problem: `test_add_skill_rejects_duplicate_skill` in the same Daytona test file carries `@unittest.skipIf(os.name == "nt", "host-backed Daytona fake relies on POSIX sandbox commands")`.

### Error Messages

```
RuntimeError: Failed to install skill ''pack'': [WinError 2] The system cannot find the file specified
File "src/agentscope/workspace/_base.py", line 1399, in add_skill_archive
```

```
tests/workspace_daytona_test.py:1254: in test_offload_context_tool_result_and_reset
self.assertTrue(await self.workspace._backend.file_exists("/home/daytona/sessions"))
E AssertionError: False is not true
# (`test -e` runs on the host via cmd.exe and fails, so file_exists is always False)
```

### Steps to Reproduce

1. On Windows, ensure Git''s `usr/bin` is not on `PATH` (`where mv` finds nothing).
2. `uv venv --python 3.11 && uv pip install -e ".[dev]"`
3. `python -m pytest tests/workspace_skill_archive_test.py tests/workspace_daytona_test.py -q`
4. Observe the three failures above.

### Environment

- AgentScope Version: 2.0.8 (main @ b82253b)
- Python Version: 3.11.15 / 3.13.9 (both affected)
- OS: Windows 11

贡献指南

打开贡献指南

调研方向

Run the two named test files on Windows without Git's usr/bin on PATH, then inspect src/agentscope/workspace/_base.py around add_skill_archive and the host-backed Daytona fake used by tests/workspace_daytona_test.py. Confirm the three failures are caused by host POSIX commands, and consider the work complete when both test files pass without that PATH dependency while the existing sandbox behavior remains covered.

由索引模型根据 Issue 内容生成。

评估

技术栈
python, shell
领域
operating-systems, testing-qa
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
描述清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。