@@ -150,20 +150,58 @@ describe("openai-compatible adapter reasoning_content handling", () => {
150150 . messages ;
151151 }
152152
153- test ( "strips reasoning_content from input messages for DeepSeek models" , ( ) => {
154- const assistant = messagesFor ( "deepseek-v4 " ) . find (
153+ test ( "strips reasoning_content from input messages for pre-V4 DeepSeek models" , ( ) => {
154+ const assistant = messagesFor ( "deepseek-v3 " ) . find (
155155 ( m ) => m [ "role" ] === "assistant" ,
156156 ) ;
157157 expect ( assistant ) . toBeDefined ( ) ;
158158 expect ( "reasoning_content" in defined ( assistant ) ) . toBe ( false ) ;
159159 } ) ;
160160
161+ test . each ( [
162+ "deepseek-v4" ,
163+ "deepseek-v4-pro" ,
164+ "deepseek-v4-flash" ,
165+ "deepseek-v4-flash-vision-exp" ,
166+ ] ) ( "V4 keeps reasoning_content on replayed assistant turns (%s)" , ( model ) => {
167+ const assistant = messagesFor ( model ) . find ( ( m ) => m [ "role" ] === "assistant" ) ;
168+ expect ( assistant ) . toBeDefined ( ) ;
169+ expect ( assistant ?. [ "reasoning_content" ] ) . toBe ( "ponder" ) ;
170+ } ) ;
171+
161172 test ( "keeps reasoning_content for non-DeepSeek models" , ( ) => {
162173 const assistant = messagesFor ( "kimi-k2" ) . find (
163174 ( m ) => m [ "role" ] === "assistant" ,
164175 ) ;
165176 expect ( assistant ?. [ "reasoning_content" ] ) . toBe ( "ponder" ) ;
166177 } ) ;
178+
179+ test ( "non-V4/non-DeepSeek models are byte-identical on reasoning_content" , ( ) => {
180+ for ( const model of [
181+ "gpt-5" ,
182+ "gpt-5.1" ,
183+ "kimi-k2" ,
184+ "grok-4.6" ,
185+ "claude-sonnet-4.5" ,
186+ "glm-5.3" ,
187+ "openai-compatible-generic" ,
188+ ] ) {
189+ const assistant = messagesFor ( model ) . find (
190+ ( m ) => m [ "role" ] === "assistant" ,
191+ ) ;
192+ expect ( assistant ?. [ "reasoning_content" ] ) . toBe ( "ponder" ) ;
193+ }
194+ } ) ;
195+
196+ test ( "pre-V4 DeepSeek ids still strip reasoning_content (byte-identical)" , ( ) => {
197+ for ( const model of [ "deepseek-v3" , "deepseek-r1" ] ) {
198+ const assistant = messagesFor ( model ) . find (
199+ ( m ) => m [ "role" ] === "assistant" ,
200+ ) ;
201+ expect ( assistant ) . toBeDefined ( ) ;
202+ expect ( "reasoning_content" in defined ( assistant ) ) . toBe ( false ) ;
203+ }
204+ } ) ;
167205} ) ;
168206
169207describe ( "openai-compatible adapter V4 effort wiring" , ( ) => {
0 commit comments