bug: codex 0.152.1 升级后 /review 无法执行任何命令
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
## 问题描述
把随包 codex 从 0.145.0 升级到 0.152.1 后,`/review` 的 Reviewer 任务无法执行任何命令。
0.152.1 新增了一层命令策略:在 `approvalPolicy: 'never'` + 受限沙箱的组合下,命令被直接拒绝,而不是升级去请求审批。`/review` 用的正是这个组合(`packages/maker-core/src/agents/codex/index.ts:5148`):
```ts
if (reviewMode) return { approvalPolicy: 'never', sandbox: 'read-only' };
```
0.152.1 的工具清单里没有独立的读文件工具(只有 `exec_command` / `write_stdin` / `request_user_input` / `view_image`),Codex 读代码依赖 `exec_command`。命令被拒等于 Reviewer 读不到任何东西,无法满足 `docs/product-rules/review-product-direction.md` §1.3「Reviewer 必须重新读取成果并验证结论」与 §1.5「必须同时验证代码路径和真实交付结果」。
**期望**:Reviewer 在只读沙箱内仍可执行只读命令。
**实际**:命令被策略拒绝,Reviewer 无法读取任何成果。
## 环境
- Cindy: `main` @ 6e114a357(codex 升级目前是本地未提交改动)
- 平台: Windows 11 Pro 26200 / win32-x64
- codex: 0.145.0(当前随包)→ 0.152.1(升级目标)
## 复现步骤
1. 用 0.152.1 真二进制起 app-server 会话,`thread/start` 传 `/review` 的权限组合(`approvalPolicy: 'never'` + `sandbox: 'read-only'`)。
2. 让模型调用 `exec_command` 读工作目录下的一个文件。
3. 命令被拒,工具输出为策略拒绝错误;换 0.145.0 同样步骤可正常执行。
## 实测矩阵(Windows,真二进制 + app-server)
| 权限组合 | 对应 Cindy 模式 | 0.145.0 | 0.152.1 |
|---|---|---|---|
| `never` + `read-only` | `/review` | ✅ 执行 | ❌ blocked by policy |
| `never` + `workspace-write` | — | ✅ 执行 | ❌ blocked by policy |
| `never` + `danger-full-access` | Full access | 未测 | ✅ 执行 |
| `on-request` + `workspace-write`(host 批准) | 手动审批 | 未测 | ✅ 执行 |
| `on-request` + `workspace-write` + `auto_review` | Auto-review | 未测 | ⚠️ 未被硬拒,升级给内置 reviewer(未端到端确认) |
| `untrusted` + `read-only`(host 批准) | 候选修复 | 未测 | ✅ 执行 |
拒绝原文:
```
exec_command failed for `"...powershell.exe" -Command "..."`:
CreateProcess { message: "Rejected(`...` rejected: blocked by policy)" }
```
已排除的干扰项:不是 `CODEX_HOME` 位于系统临时目录导致的(把 `CODEX_HOME` 移出临时目录后结果一致)。
## 影响面
- Full access、手动审批:**不受影响**
- Auto-review:**不受影响**(有审批通道,升级给 Codex 内置 reviewer)
- `/review`:**受影响**
- 现有用户:**不受影响** —— 该 codex 升级尚未提交、未发版,问题在发布前被 e2e 顶出来
## 第二处阻塞
即使把 reviewMode 的 `approvalPolicy` 换成 `untrusted`,`index.ts:7226` 仍会拒掉升级上来的请求:
```ts
if (reviewMode) return { decision: 'decline' };
```
这行在原设计下无害(`never` 不会产生审批请求),属防御性写法。
## 建议方案(需产品裁决)
1. reviewMode 权限改为 `{ approvalPolicy: 'untrusted', sandbox: 'read-only' }`(实测该组合在 0.152.1 上可正常执行命令)。
2. `commandExecutionApproval` 在 reviewMode 下不再无条件 `decline`,改为接受。
**安全边界不变**:沙箱层面仍是 `read-only`,写入依然不可能;host shell policy 检查仍在前面生效。变动的只是「reviewMode 不接受任何审批升级」这条实现假设 —— 它成立的前提(`never` 下不产生审批请求)在 0.152.1 已失效。
按 `review-product-direction.md` §5,这属于改动「已裁决」部分,请 @zqchris 裁决是否照此修改,或选择押后 codex 升级。
## 同一次升级的另一个问题(已修,待提 PR)
0.152.1 开始把本地生成的 item id 回传进 Responses `input`(0.145 一律不带 id)。Cindy 的 exec custom→function 适配器只改写 `type` 不改写 `id`,导致自建 Responses provider 返回 400:
```json
{"error":{"code":"invalid_value","message":"Invalid 'input[6].id': 'ctco_…'. Expected an ID that begins with 'fc'.","param":"input[6].id","type":"invalid_request_error"}}
```
修复:方言翻转时同步翻转 id 前缀(`ctco_`→`fco_`、`ctc_`→`fc_`),认不出的前缀退回不带 id(0.145 形态);同时给 `codexExecFunctionAdapter` e2e 的假上游加 prefix↔type 校验,让后续 bump 能自动发现同类 wire 形状变化。
## 未覆盖
- 只在 Windows 上验证,错误是 `CreateProcess` 形态,可能是 Windows 专有策略实现;macOS / Linux 未测。
- 用与 `/review` 等价的权限组合验证,**未从新构建的 Desktop 点击 `/review`**。按 `review-product-direction.md` §1.5,这两者必须区分记录。
Contributor guide
Research direction
Start with packages/maker-core/src/agents/codex/index.ts at lines 5148 and 7226, then reproduce the review permission combinations against Codex 0.152.1 using the app-server steps in the issue. Check the review-product-direction.md requirements and verify the chosen behavior on Windows; done means /review can read and validate results in the read-only sandbox, including a fresh Desktop end-to-end check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai-infra-agents, devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100