Closed
Description
问题与影响
Windows 上由 OpenDirector 启动的 Codex 运行时无法执行 Shell 命令:会话可以开始,但读取文件、运行 opendirector CLI 等操作被沙箱拒绝,助手因此无法完成任何需要实际执行的任务。用户看到的是一轮"没有动作"的回复,而不是可理解的权限错误。
复现步骤
- Windows 上配置 Codex 运行时,创建工程并让助手执行需要 Shell 的任务(例如"列出工程里的素材")。
- 观察 Codex 启动参数:
codex exec --ignore-user-config --ignore-rules --sandbox workspace-write ...。 - 助手调用 Shell 时命令立即失败,无法读取工作目录或执行
opendirector。
预期与实际
- 预期:
--sandbox workspace-write允许在工程目录内读写并执行命令,审批与沙箱约束保持生效。 - 实际:
--ignore-user-config同时移除了windows.sandbox配置;缺少 Windows 沙箱后端时,Codex 把workspace-write降级为只读,写操作与 Shell 执行都被拦截。 - 附带问题:执行上下文与系统提示要求用
command -v opendirector发现 CLI,而 PowerShell 没有该命令,Windows 上的命令发现步骤必然失败。
修复
- 仅在
win32上追加-c windows.sandbox="elevated",保留--sandbox workspace-write、审批与隔离参数,不使用任何绕过沙箱的开关。 - 命令发现改为:PowerShell 使用
Get-Command opendirector,POSIX Shell 使用command -v opendirector;同步tools.py系统提示与native.py执行上下文。 docs/architecture/agent-runtime.md补充中英文说明。
验收标准
- Windows 上 Codex 会话可以执行 Shell、读写工程目录并调用
opendirector,沙箱仍为workspace-write。 - 非 Windows 平台不追加
windows.sandbox,启动参数与当前一致。 - 启动参数不包含
--dangerously-bypass-approvals-and-sandbox等绕过开关。 - 回归测试覆盖 win32、linux、darwin 三种平台的参数差异。
- PowerShell 与 POSIX Shell 的命令发现说明在提示词与文档中一致。
Metadata
Metadata
Assignees
Labels
No labels
Activity
[bugfix] agent: keep the Windows Codex sandbox writable (ThinkFlowLab…
[bugfix] agent: keep the Windows Codex sandbox writable (ThinkFlowLab…
[bugfix] canvas: show measured video duration separately
[feat] video: add FastH3 dual-frame adapter and a writable Windows Co…