Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Add DeepSeek V4 Flash and Pro models - #12218

Open
avaritiachaos wants to merge 4 commits into
RooCodeInc:mainfrom
avaritiachaos:add-deepseek-v4-models
Open

avaritiachaos wants to merge 4 commits into
RooCodeInc:mainfrom
avaritiachaos:add-deepseek-v4-models

Conversation

@avaritiachaos

@avaritiachaos avaritiachaos commented Apr 29, 2026 •

Copy link
Copy Markdown

Summary

  • add DeepSeek V4 Flash and Pro model definitions
  • support DeepSeek V4 thinking mode controls and reasoning_effort mapping (xhigh -> max)
  • cover native DeepSeek and OpenAI-compatible DeepSeek endpoints with tests

Test plan

  • corepack pnpm --dir src exec vitest run api/providers/tests/deepseek.spec.ts api/providers/tests/openai.spec.ts
  • corepack pnpm --dir src exec tsc --noEmit
  • corepack pnpm --dir packages/types exec tsc --noEmit

Interactively review PR in Roo Code Cloud

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Enhancement New feature or request labels Apr 29, 2026
@avaritiachaos
avaritiachaos force-pushed the add-deepseek-v4-models branch from bfe0c3f to 8d50030 Compare April 29, 2026 04:23
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Apr 29, 2026
@avaritiachaos
avaritiachaos force-pushed the add-deepseek-v4-models branch 2 times, most recently from c2c4003 to 4b44a2c Compare April 29, 2026 05:09
@avaritiachaos
avaritiachaos force-pushed the add-deepseek-v4-models branch from 4b44a2c to e882b9d Compare April 29, 2026 05:14
@466348376

Copy link
Copy Markdown

太好了。太好了,坐着等两三天了

@466348376

Copy link
Copy Markdown

懂github的朋友,如果更新了deepseek v4后,麻烦艾特我一下,谢谢

@lazyupdate lazyupdate left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for this PR — the thinking mode and reasoning_effort mapping work is solid.

However, there's a bug in the streaming handler that this doesn't address:

src/api/providers/openai.ts line ~234:

if ("reasoning_content" in delta && delta.reasoning_content) {

When DeepSeek V4 returns an empty reasoning_content: "" (which it does in certain streaming chunks), delta.reasoning_content is falsy → the block is skipped → reasoning_content is never stored on the assistant message → the next request lacks it → DeepSeek returns 400.

Fix (1 line):

- if ("reasoning_content" in delta && delta.reasoning_content) {
+ if ("reasoning_content" in delta && typeof delta.reasoning_content === "string") {

To reproduce in isolation:

  1. Run a mock OpenAI server that SSE-streams reasoning_content: "" + a tool_call (e.g. bash)
  2. Let the agent execute the tool and construct the follow-up request
  3. The mock returns 400 because reasoning_content was dropped
  4. With the typeof fix, the field is preserved (even as "") and the mock returns 200

@avaritiachaos

Copy link
Copy Markdown
Author

@lazyupdate

Thanks for catching this edge case and providing the detailed reproduction steps!

I've applied the typeof fix to preserve the empty reasoning chunks. I also checked the official deepseek.ts provider, fixed the exact same falsy evaluation issue there, and added regression tests for both.

PTAL!

@avaritiachaos
avaritiachaos requested a review from lazyupdate May 1, 2026 13:17

This branch has not been deployed

No deployments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants