环境
- Windows 11 (10.0.22631)、Python 3.12、
pip install -e . 源码安装 v0.1.7
- 后端:opencode CLI 1.18.21
现象
lh-harness run 在 Windows 上从启动引导到运行循环多处直接失败,无法完成任何任务:
Cannot start run: unsafe run directory layout: secure control-bus directory creation is unavailable
绕过引导后继续暴露:
| 阶段 |
错误 |
| 控制总线/事件账本 |
O_NOFOLLOW、dir_fd、fcntl.flock 均为 POSIX 专属,Windows 直接不可用 |
| 角色提示词写入 |
执行 mkdir -p / chmod(cmd.exe 无此命令) |
| 所有角色 episode |
命令模板使用 POSIX 单引号与 VAR=x cmd 前缀,cmd.exe 解析失败(0.1s 即 error) |
| Executor 超时清理 |
signal.SIGKILL 在 Windows 不存在 → AttributeError → worker_exception |
| 进程存活探测 |
os.kill(pid, 0) 在 Windows 语义是 TerminateProcess(pid, 0),会把"探测"变成"击杀",且 pid 复用后会误杀无关进程(实测打断过整个测试进程树) |
根因归纳
- 锚定无符号链接遍历(
O_NOFOLLOW + dir_fd)与 fcntl.flock 无 Windows 等价物,代码在这些平台选择 fail-closed,但没有降级路径;
- 命令模板硬编码 POSIX shell 语法;
- 进程组 API(
killpg/SIGKILL/SIGHUP)直接引用;
- 仓库此前没有任何测试 CI(仅 release workflow),以上问题无法被自动发现。
复现
任意 Windows 机器源码安装后执行:
lh-harness run --task "检查当前目录并总结其中的文件。" --no-dashboard
修复
PR #66(两个 commit)已完整修复并在 Windows 11 实测:
- 全量测试套件 402 passed / 4 skipped / 0 failed(修复前:启动即崩)
- 新增 Windows Job Object 封装(内核保证进程树终止,免疫 pid 复用)
- 新增三平台(ubuntu/windows/macos)pytest CI
Fixes 通过 PR #66 交付,欢迎 review。
环境
pip install -e .源码安装 v0.1.7现象
lh-harness run在 Windows 上从启动引导到运行循环多处直接失败,无法完成任何任务:绕过引导后继续暴露:
O_NOFOLLOW、dir_fd、fcntl.flock均为 POSIX 专属,Windows 直接不可用mkdir -p/chmod(cmd.exe 无此命令)VAR=x cmd前缀,cmd.exe 解析失败(0.1s 即 error)signal.SIGKILL在 Windows 不存在 → AttributeError → worker_exceptionos.kill(pid, 0)在 Windows 语义是 TerminateProcess(pid, 0),会把"探测"变成"击杀",且 pid 复用后会误杀无关进程(实测打断过整个测试进程树)根因归纳
O_NOFOLLOW+dir_fd)与fcntl.flock无 Windows 等价物,代码在这些平台选择 fail-closed,但没有降级路径;killpg/SIGKILL/SIGHUP)直接引用;复现
任意 Windows 机器源码安装后执行:
lh-harness run --task "检查当前目录并总结其中的文件。" --no-dashboard修复
PR #66(两个 commit)已完整修复并在 Windows 11 实测:
Fixes 通过 PR #66 交付,欢迎 review。