fix(deepseek): preserve reasoning_content through full pipeline for DeepSeek V4 models - #2231
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for DeepSeek V4 models, specifically focusing on their reasoning capabilities. Key changes include updating the provider registry, enhancing the response sanitizer to preserve reasoning content for DeepSeek V4, and extending the reasoning cache to support request-based keys when tool calls are absent. Feedback from the review suggests centralizing the model detection regex patterns to avoid inconsistencies and refining the model identification logic in the translator to prevent overly broad matching that could lead to false positives.
|
Hey @kang-heewon! Thanks for the deep work on DeepSeek V4 reasoning preservation. This PR overlaps significantly with work already merged in
The new Could you rebase against the current
Happy to review the rebased version. Leaving open. |
…rry-pick from PR #2231) Cherry-picks non-overlapping changes from @kang-heewon's PR #2231: - isDeepSeekV4Model() check in responseSanitizer - providerRegistry V4 model entries with supportsReasoning - schemaCoercion model-param for injectEmptyReasoningContentForToolCalls - reasoningCache request-ID-based stable keys - translator reasoning-only message replay for DeepSeek - Comprehensive test coverage (81 tests across 5 providers) Co-authored-by: kang-heewon <owen@kangheewon.dev>
…ct signature After cherry-picking PR #2231, the function signature changed from positional (provider, model) to object ({ provider, model }). Fixes the 2 pre-existing tests that still used the old positional style.
Deep audit of all 320 commits since v3.7.9 found: - 18 merged PRs not documented in CHANGELOG (4 features, 10 bug fixes, 1 security, 2 chores, 1 debug improvement) - 3 contributors entirely missing from credits table (@NomenAK with 12 PRs, @kang-heewon, @one-vs) - 4 existing contributors with inaccurate PR counts (@oyi77 8→12, @ddarkr 2→3, @andrewmunsell 2→3, @nickwizard 2→3) New entries added: - feat: #2135 (1proxy settings), #2227 (antigravity project ID), #2238 (Z.AI Search), #2240 (CLI Suite) - fix: #2217, #2218, #2219, #2221, #2222, #2223, #2224, #2231, #2233, #2236, #2242, #2243 - security: #2209 (stack trace exposure) - chore: #2228, #2234 Total contributors updated from 50+ to 55+.
…eepseek boundary test
2ad82d0 to
e8268db
Compare
|
Rebase complete. Here is what was done: Rebased on
Regarding your 3 requests:
Remaining delta (2 files, 4 insertions, 2 deletions):
Both changes are PR review feedback from gemini-code-assist. The PR description has been updated to reflect the current scope. |
…rry-pick from PR diegosouzapw#2231) Cherry-picks non-overlapping changes from @kang-heewon's PR diegosouzapw#2231: - isDeepSeekV4Model() check in responseSanitizer - providerRegistry V4 model entries with supportsReasoning - schemaCoercion model-param for injectEmptyReasoningContentForToolCalls - reasoningCache request-ID-based stable keys - translator reasoning-only message replay for DeepSeek - Comprehensive test coverage (81 tests across 5 providers) Co-authored-by: kang-heewon <owen@kangheewon.dev>
…ct signature After cherry-picking PR diegosouzapw#2231, the function signature changed from positional (provider, model) to object ({ provider, model }). Fixes the 2 pre-existing tests that still used the old positional style.
Deep audit of all 320 commits since v3.7.9 found: - 18 merged PRs not documented in CHANGELOG (4 features, 10 bug fixes, 1 security, 2 chores, 1 debug improvement) - 3 contributors entirely missing from credits table (@NomenAK with 12 PRs, @kang-heewon, @one-vs) - 4 existing contributors with inaccurate PR counts (@oyi77 8→12, @ddarkr 2→3, @andrewmunsell 2→3, @nickwizard 2→3) New entries added: - feat: diegosouzapw#2135 (1proxy settings), diegosouzapw#2227 (antigravity project ID), diegosouzapw#2238 (Z.AI Search), diegosouzapw#2240 (CLI Suite) - fix: diegosouzapw#2217, diegosouzapw#2218, diegosouzapw#2219, diegosouzapw#2221, diegosouzapw#2222, diegosouzapw#2223, diegosouzapw#2224, diegosouzapw#2231, diegosouzapw#2233, diegosouzapw#2236, diegosouzapw#2242, diegosouzapw#2243 - security: diegosouzapw#2209 (stack trace exposure) - chore: diegosouzapw#2228, diegosouzapw#2234 Total contributors updated from 50+ to 55+.
… through full pipeline for DeepSeek V4 models (thanks @kang-heewon) Squash merge as part of the v3.8.0 release housekeeping. Closes diegosouzapw#2231.
…rry-pick from PR diegosouzapw#2231) Cherry-picks non-overlapping changes from @kang-heewon's PR diegosouzapw#2231: - isDeepSeekV4Model() check in responseSanitizer - providerRegistry V4 model entries with supportsReasoning - schemaCoercion model-param for injectEmptyReasoningContentForToolCalls - reasoningCache request-ID-based stable keys - translator reasoning-only message replay for DeepSeek - Comprehensive test coverage (81 tests across 5 providers) Co-authored-by: kang-heewon <owen@kangheewon.dev>
…ct signature After cherry-picking PR diegosouzapw#2231, the function signature changed from positional (provider, model) to object ({ provider, model }). Fixes the 2 pre-existing tests that still used the old positional style.
Deep audit of all 320 commits since v3.7.9 found: - 18 merged PRs not documented in CHANGELOG (4 features, 10 bug fixes, 1 security, 2 chores, 1 debug improvement) - 3 contributors entirely missing from credits table (@NomenAK with 12 PRs, @kang-heewon, @one-vs) - 4 existing contributors with inaccurate PR counts (@oyi77 8→12, @ddarkr 2→3, @andrewmunsell 2→3, @nickwizard 2→3) New entries added: - feat: diegosouzapw#2135 (1proxy settings), diegosouzapw#2227 (antigravity project ID), diegosouzapw#2238 (Z.AI Search), diegosouzapw#2240 (CLI Suite) - fix: diegosouzapw#2217, diegosouzapw#2218, diegosouzapw#2219, diegosouzapw#2221, diegosouzapw#2222, diegosouzapw#2223, diegosouzapw#2224, diegosouzapw#2231, diegosouzapw#2233, diegosouzapw#2236, diegosouzapw#2242, diegosouzapw#2243 - security: diegosouzapw#2209 (stack trace exposure) - chore: diegosouzapw#2228, diegosouzapw#2234 Total contributors updated from 50+ to 55+.
… through full pipeline for DeepSeek V4 models (thanks @kang-heewon) Squash merge as part of the v3.8.0 release housekeeping. Closes diegosouzapw#2231.
Summary
Rebased against upstream release/v3.8.0 (bbf3ba0). The 4 core DeepSeek V4 reasoning replay commits from this PR were already cherry-picked by upstream, so only the PR review feedback changes remain.
Remaining Changes (2 files, 4 insertions, 2 deletions)
1. responseSanitizer.ts — Extract inline regex to constant
/deepseek[-/]v4/iinline regex toDEEPSEEK_V4_SANITIZER_MODEL_PATTERNconstant2. translator/index.ts — Boundary-aware DeepSeek detection
normalizedModel.includes("deepseek")→/(^|\/)deepseek/i.test(normalizedModel)Verification
npm run typecheck:core— clean (1 pre-existing ioredis error unrelated)lsp_diagnostics— clean on both changed files