Codex 0.145 + 第三方模型调 exec 时 payload 不兼容,本地命令全部 Fatal abort 并空转燃 token
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**提交人**: CC
**客户端版本**: 0.1.46
---
## 现象
Cindy 内置 Codex agent(cli 0.145.0)接 Grok / DeepSeek 等第三方模型时,本地 `exec` 在进入 shell 之前就失败。界面表现为工具被 abort;模型不断重试同一次调用,浪费 token,最终仍跑不成任何本地命令。网络类工具(如 web_search)可以成功。MCP / 会话历史等能力也挂在 `exec` 里,一并坏掉。
## 复现步骤
1. 新建会话,Agent 选 Codex,模型选 Grok 4.6 或 DeepSeek-V4-Flash(经 cliproxy / cindy_gateway)。
2. 让 agent 执行任何本地操作(例如查 Git 状态、读项目文件、跑一条 shell)。
3. 观察 `exec` 是否立刻 abort,以及模型是否空转重试。
## 期望行为
- 第三方模型能正常调用本地命令 / 读写文件;或
- payload 不符合时返回可纠正的 schema 错误,而不是 Fatal abort;并阻止同一回合无参重试。
## 实际行为
- Codex 日志:`Fatal error: tool exec invoked with incompatible payload`(`codex_core::tools::router`)
- 模型见到的是 exec aborted,继续换格式再调,仍 abort
- 一个回合可浪费数十万 token,仍无一条本地命令成功
## 复现频率
用户未给出「每次 / 偶发」的主观统计。诊断侧在多场 Codex + Grok、Codex + DeepSeek 会话中都看到同一类失败。官方 Codex 模型是否受影响:用户未知。
## 已尝试
用户未提供自行尝试清单。诊断排除:非权限弹窗拒绝、非目录未 trusted、非沙箱拦截。该环境 `sandbox_mode=danger-full-access`,`approval_policy=unless-trusted`,目录已标 trusted。
## 脱敏诊断摘要
用户同意公开以下摘要(已去除个人路径 / 账号 / 完整日志):
- Cindy Codex 0.145.0,provider=`cindy_gateway`,模型例:Grok 4.6、DeepSeek-V4-Flash
- Codex 0.145 的 `exec` 期望 **JS 源码 payload**(内部再调 `tools.shell_command` 等),不是普通 JSON tool args
- Grok rollout 里每次 `function_call name=exec` 的 `arguments` 都是 `{}`
- DeepSeek 同类会话发的是 `{"command":"const r = await tools.shell_command(...)"}`,仍被判 incompatible
- 同一轮次出现数十次空 `exec`;模型 reasoning 已猜到要把 JS 当第一参数,但 function-call 通道只能发 JSON,最终被收成 `{}`
- 失败后无可纠正 schema 提示,只有 fatal abort
## 建议方向(供参考)
1. 兼容 `{command: "..."}` 为 shell;或
2. 非法 payload 回明确 schema 错误,并禁止同一回合无参重试;或
3. 给第三方模型单独暴露顶层 `shell_command` / `read`,不要只给 `exec`
---
**版本区域**: CN
**OS**: win32 x64 (10.0.19044)
**界面语言**: zh-CN
Contributor guide
Research direction
Start at the `codex_core::tools::router` path named in the diagnostic and trace how third-party function-call arguments reach `exec`. Reproduce with the `{}` and `{"command":...}` payloads described for Grok and DeepSeek. Done means local commands work with supported payloads or incompatible input produces a corrective schema error without repeated empty retries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100