fix(provider): preserve reasoning_content on second interleaved pass (#24146 follow-up)#24443
Open
claudianus wants to merge 2 commits intoanomalyco:devfrom
Open
fix(provider): preserve reasoning_content on second interleaved pass (#24146 follow-up)#24443claudianus wants to merge 2 commits intoanomalyco:devfrom
claudianus wants to merge 2 commits intoanomalyco:devfrom
Conversation
PR anomalyco#24146 unconditionally sets reasoning_content to the extracted value. On the second pass through transform (after DB storage), content parts no longer have reasoning (already extracted in first pass), so the extracted value is empty. This overwrites the previously correct providerOptions.reasoning_content, causing DeepSeek 400: The 'reasoning_content' in the thinking mode must be passed back to the API. Fix: when reasoningText is empty, fall back to the existing providerOptions[sdk][field] value before defaulting to empty string. This preserves non-empty reasoning from the first pass while still sending empty reasoning_content when DeepSeek requires it (the case PR anomalyco#24146 was fixing). Also use dynamic SDK key ([sdk]) instead of hardcoded openaiCompatible for provider flexibility.
Models.dev may have reasoning:true but no explicit interleaved config.
Default interleaved to {field: 'reasoning_content'} so the transform
pipeline correctly extracts reasoning parts into providerOptions.
Bojun-Vvibe
added a commit
to Bojun-Vvibe/oss-contributions
that referenced
this pull request
Apr 26, 2026
…ode shell continuations - anomalyco/opencode#24443 merge-after-nits: preserve reasoning_content on second interleaved transform pass (DeepSeek 400 fix); flag scoped catch-all blast radius - anomalyco/opencode#24320 merge-as-is: project-relative pattern in Read tool ctx.ask so user-config deny rules actually fire - qwen-code#3600 merge-after-nits: backslash-LF continuation handling in splitCommands, with CRLF security-invariant test
Contributor
Author
cubic review 분석 (
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #24442
Type of change
What does this PR do?
Fixes a regression from PR #24146 where
reasoning_contentis lost on the second pass through the interleaved transform.Root cause: The interleaved transform runs on every request. First pass extracts reasoning from content → stores in providerOptions ✅. Second pass (after DB round-trip) finds no reasoning in content (already extracted), so
reasoningText = ""→ unconditionally overwritesproviderOptions.reasoning_content→ DeepSeek 400 error.Changes
reasoningTextis empty, fall back to existingproviderOptions[sdk][field]value before defaulting to empty string. This preserves non-empty reasoning from the first pass.provider.ts: Default
interleaved: { field: "reasoning_content" }for reasoning models infromModelsDevModel()when models.dev hasreasoning: truebut no explicitinterleavedconfig.transform.ts: Use dynamic SDK key (
[sdk]) instead of hardcodedopenaiCompatiblefor non-standard providers (e.g., OpenRouter).How did you verify your code works?
""(preserves fix: preserve empty reasoning_content for DeepSeek V4 thinking mode #24146 fix)Screenshots / recordings
N/A
Checklist