Skip to content

fix(codex): filter unsupported DeepSeek V4 custom tools - #3003

Open
yuaiccc wants to merge 2 commits into
makecindy:mainfrom
yuaiccc:fix/deepseek-v4-custom-tools
Open

fix(codex): filter unsupported DeepSeek V4 custom tools#3003
yuaiccc wants to merge 2 commits into
makecindy:mainfrom
yuaiccc:fix/deepseek-v4-custom-tools

Conversation

@yuaiccc

@yuaiccc yuaiccc commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

DeepSeek V4's Responses compatibility endpoint accepts the host's apply_patch custom tool but rejects every other Codex custom tool (notably exec), causing 400 errors. This adds a narrow sanitization transform that:

  • Removes unsupported custom tool dialects (string form and object form) while keeping apply_patch
  • Leaves ordinary function/MCP tool declarations untouched
  • Resets tool_choice to auto when it references a removed custom tool
  • Clears tools/tool_choice/parallel_tool_calls when all tools are filtered

Tests

Added removes unsupported DeepSeek V4 custom tools but retains apply_patch regression test covering exec string, exec custom object, apply_patch string/object, and function tools.

  • pnpm --filter desktop typecheck
  • pnpm test:unit:related (codexProxyHost tests)

Risk

Low: transform is gated on deepseek/deepseek-v4-pro and deepseek/deepseek-v4-flash model IDs only.

DeepSeek V4's Responses endpoint accepts apply_patch but rejects every
other Codex custom tool (notably exec). Filter only the custom tool
dialect while keeping ordinary function/MCP tools untouched, and reset
tool_choice to auto when it references a removed custom tool.

Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
…m-tools

# Conflicts:
#	apps/desktop/src/main/maker-host/__tests__/codexProxyHost.test.ts
#	apps/desktop/src/main/maker-host/codex-proxy-host.ts
@yuaiccc
yuaiccc requested a review from a team as a code owner August 19, 2026 05:07
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a DeepSeek V4-specific request transform that removes unsupported custom tools while preserving apply_patch and ordinary function tools.

  • Resets tool selection when it references a filtered custom tool.
  • Removes tool-related fields when filtering leaves no tools.
  • Adds regression coverage and registers the transform before the existing provider compatibility transforms.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The transform is narrowly gated to the two DeepSeek V4 model IDs, preserves supported and ordinary function tools, repairs dangling tool selection, and is covered by a focused regression test.

Important Files Changed

Filename Overview
apps/desktop/src/main/maker-host/codex-proxy-host.ts Adds and registers the narrowly model-gated DeepSeek V4 custom-tool sanitizer; no actionable defect was established.
apps/desktop/src/main/maker-host/tests/codexProxyHost.test.ts Updates transform-chain expectations and verifies filtering of string/object custom tools while retaining apply_patch and function tools.

Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

@MagicLizi MagicLizi added the status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) label Aug 19, 2026

@MagicLizi MagicLizi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

格式门未通过

PR description 缺少必要段落,请补充以下内容:

  1. 这次改了什么 — 简要说明改动的目的和范围
  2. 怎么验证的 — 你是如何确认改动正确的(本地测试、复现步骤等)
  3. 风险 — 这个改动可能影响什么,有没有需要注意的边界情况

请参照 .github/PULL_REQUEST_TEMPLATE.md 补全 description 后推送新 commit 或编辑描述。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:awaiting-author 等作者修改(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants