[Bug] codex 模式下接入 DeepSeek API 无法使用:报错 "Unsupported custom tool: 'exec'. Only 'apply_patch' is supported."
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**提交人**: 秋迟
**客户端版本**: 0.1.46
---
### 现象
在设置中接入 DeepSeek API(deepseek-v4-flash / deepseek-v4-pro)后,把会话切换到 codex 模式,任何一条消息(包括"你好")都无法正常调用,每轮都报错:
```
Turn error: {"error":{"message":"Unsupported custom tool: 'exec'. Only 'apply_patch' is supported.","type":"invalid_request_error","code":"invalid_request_error"}}
```
主会话(Claude 模式)使用 DeepSeek 一切正常,仅 codex 模式失败。严重度:blocker(codex 模式完全无法使用 DeepSeek)。
### 复现步骤
1. 设置 → 模型供应商,接入 DeepSeek API
2. 新建会话并切换到 codex 模式
3. 发送任意消息(例如"你好")
4. 每轮请求都被 DeepSeek 拒绝,codex 无法继续
### 期望行为
codex 模式应能正常调用 DeepSeek 模型完成对话与编码任务。
### 实际行为
codex 每次请求都被 DeepSeek 拒绝,报 "Unsupported custom tool: 'exec'",无法产生任何有效回复。
### 复现频率
必现(100%)。
### 根因分析(已定位,含离线复现证据)
1. Cindy 启动 codex.exe 时无条件硬编码传入 `-c features.code_mode_only=true`(位于应用安装目录 resources/app.asar 的 buildCodexProxySpawnArgs 中,与供应商配置无关)。
2. 该 flag 强制 codex 使用最小工具集,shell 执行工具以 `{"type":"custom","name":"exec"}` 形式发送。
3. DeepSeek 的 Responses API(/responses)只支持 `apply_patch` 一个自定义工具,明确拒绝 `exec`。
4. codex 0.145.0 已强制 `wire_api="responses"`(配置里设置 "chat" 会直接报 "no longer supported"),无法通过退回 chat 协议规避。
5. 离线复现(本地 dummy 服务截获 codex 请求体):
- 不带 `features.code_mode_only`:shell 工具以 `function shell_command` 发送(DeepSeek 可接受);
- 带 `features.code_mode_only=true`:shell 工具以 `custom exec` 发送(DeepSeek 拒绝);
- 额外提供官方 models.json(model_catalog_json)及 experimental_supported_tools 限制均无法覆盖该 flag。
### 建议修复方向
- 移除或按供应商能力条件化 `features.code_mode_only`,或
- 在网关层对不支持 `exec` custom 工具的第三方供应商做工具降级(如退化为 `shell_command` function,或仅保留 apply_patch)。
### 已尝试的办法
- 核对 DeepSeek 供应商配置(claude-code / codex / pi 三个运行时均已正确配置)
- 对照 DeepSeek 官方 Codex 接入指南(config.toml + models.json)
- 此前曾让 agent 尝试修复,据反馈在另一台设备上修复成功,但具体方式未知,本机仍稳定复现
- 离线实验定位根因(见上)
---
**版本区域**: CN
**OS**: win32 x64 (10.0.19045)
**界面语言**: zh-CN
Contributor guide
Research direction
Locate buildCodexProxySpawnArgs in resources/app.asar and inspect how codex.exe arguments are assembled for provider configurations. Reproduce the DeepSeek /responses request with and without features.code_mode_only=true, then verify that the chosen behavior no longer sends the unsupported custom exec tool and that codex requests complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- api, desktop, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100