File tree Expand file tree Collapse file tree
packages/opencode/src/provider Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,24 +185,19 @@ function normalizeMessages(
185185 // Filter out reasoning parts from content
186186 const filteredContent = msg . content . filter ( ( part : any ) => part . type !== "reasoning" )
187187
188- // Include reasoning_content | reasoning_details directly on the message for all assistant messages
189- if ( reasoningText ) {
190- return {
191- ...msg ,
192- content : filteredContent ,
193- providerOptions : {
194- ...msg . providerOptions ,
195- openaiCompatible : {
196- ...msg . providerOptions ?. openaiCompatible ,
197- [ field ] : reasoningText ,
198- } ,
199- } ,
200- }
201- }
202-
188+ // Include reasoning_content | reasoning_details directly on the message for all assistant messages.
189+ // Always set the field even when empty — some providers (e.g. DeepSeek) may return empty
190+ // reasoning_content which still needs to be sent back in subsequent requests.
203191 return {
204192 ...msg ,
205193 content : filteredContent ,
194+ providerOptions : {
195+ ...msg . providerOptions ,
196+ openaiCompatible : {
197+ ...msg . providerOptions ?. openaiCompatible ,
198+ [ field ] : reasoningText ,
199+ } ,
200+ } ,
206201 }
207202 }
208203
You can’t perform that action at this time.
0 commit comments