File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -274,6 +274,8 @@ function resolveTranscriptPolicyCacheKey(params: {
274274 workspaceDir : params . workspaceDir ,
275275 env : params . env ,
276276 } ) ,
277+ dropReasoningFromHistory :
278+ params . config . models ?. providers ?. [ params . provider ] ?. dropReasoningFromHistory ,
277279 } ) ;
278280}
279281
@@ -331,6 +333,16 @@ export function resolveTranscriptPolicy(params: {
331333 model : params . model ,
332334 } ) ,
333335 ) ;
336+
337+ // Apply user-configured override for reasoning content replay behavior.
338+ // Users can set dropReasoningFromHistory: false in provider config to preserve
339+ // reasoning/thinking blocks (e.g. reasoning_content) for openai-completions providers.
340+ const configuredDropReasoning =
341+ params . config ?. models ?. providers ?. [ params . provider ?? "" ] ?. dropReasoningFromHistory ;
342+ if ( typeof configuredDropReasoning === "boolean" ) {
343+ policy . dropReasoningFromHistory = configuredDropReasoning ;
344+ }
345+
334346 if ( cacheConfig && cacheKey ) {
335347 let configCache = transcriptPolicyCache . get ( cacheConfig ) ;
336348 if ( ! configCache ) {
Original file line number Diff line number Diff line change @@ -186,6 +186,8 @@ export type ModelProviderConfig = {
186186 headers ?: Record < string , SecretInput > ;
187187 authHeader ?: boolean ;
188188 request ?: ConfiguredModelProviderRequest ;
189+ /** If false, preserve reasoning/thinking blocks in replayed history for openai-completions providers. */
190+ dropReasoningFromHistory ?: boolean ;
189191 models : ModelDefinitionConfig [ ] ;
190192} ;
191193
Original file line number Diff line number Diff line change @@ -487,6 +487,8 @@ const ModelProviderSchema = z
487487 headers : z . record ( z . string ( ) , SecretInputSchema . register ( sensitive ) ) . optional ( ) ,
488488 authHeader : z . boolean ( ) . optional ( ) ,
489489 request : ConfiguredModelProviderRequestSchema ,
490+ /** If false, preserve reasoning/thinking blocks in replayed history for openai-completions providers. */
491+ dropReasoningFromHistory : z . boolean ( ) . optional ( ) ,
490492 models : z . array ( ModelDefinitionSchema ) . optional ( ) ,
491493 } )
492494 . strict ( ) ;
You can’t perform that action at this time.
0 commit comments