@@ -31,6 +31,7 @@ use codex_protocol::models::ReasoningItemContent;
3131use codex_protocol:: models:: ReasoningItemReasoningSummary ;
3232use codex_protocol:: models:: ResponseItem ;
3333use codex_protocol:: models:: WebSearchAction ;
34+ use codex_protocol:: openai_models:: ModelsResponse ;
3435use codex_protocol:: openai_models:: ReasoningEffort ;
3536use codex_protocol:: protocol:: EventMsg ;
3637use codex_protocol:: protocol:: Op ;
@@ -980,7 +981,9 @@ async fn user_turn_collaboration_mode_overrides_model_and_effort() -> anyhow::Re
980981 sandbox_policy : config. permissions . sandbox_policy . get ( ) . clone ( ) ,
981982 model : session_configured. model . clone ( ) ,
982983 effort : Some ( ReasoningEffort :: Low ) ,
983- summary : config. model_reasoning_summary ,
984+ summary : config
985+ . model_reasoning_summary
986+ . unwrap_or ( ReasoningSummary :: Auto ) ,
984987 collaboration_mode : Some ( collaboration_mode) ,
985988 final_output_json_schema : None ,
986989 personality : None ,
@@ -1014,7 +1017,7 @@ async fn configured_reasoning_summary_is_sent() -> anyhow::Result<()> {
10141017 . await ;
10151018 let TestCodex { codex, .. } = test_codex ( )
10161019 . with_config ( |config| {
1017- config. model_reasoning_summary = ReasoningSummary :: Concise ;
1020+ config. model_reasoning_summary = Some ( ReasoningSummary :: Concise ) ;
10181021 } )
10191022 . build ( & server)
10201023 . await ?;
@@ -1058,7 +1061,7 @@ async fn reasoning_summary_is_omitted_when_disabled() -> anyhow::Result<()> {
10581061 . await ;
10591062 let TestCodex { codex, .. } = test_codex ( )
10601063 . with_config ( |config| {
1061- config. model_reasoning_summary = ReasoningSummary :: None ;
1064+ config. model_reasoning_summary = Some ( ReasoningSummary :: None ) ;
10621065 } )
10631066 . build ( & server)
10641067 . await ?;
@@ -1089,6 +1092,60 @@ async fn reasoning_summary_is_omitted_when_disabled() -> anyhow::Result<()> {
10891092 Ok ( ( ) )
10901093}
10911094
1095+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
1096+ async fn reasoning_summary_none_overrides_model_catalog_default ( ) -> anyhow:: Result < ( ) > {
1097+ skip_if_no_network ! ( Ok ( ( ) ) ) ;
1098+ let server = MockServer :: start ( ) . await ;
1099+
1100+ let resp_mock = mount_sse_once (
1101+ & server,
1102+ sse ( vec ! [ ev_response_created( "resp1" ) , ev_completed( "resp1" ) ] ) ,
1103+ )
1104+ . await ;
1105+
1106+ let mut model_catalog: ModelsResponse =
1107+ serde_json:: from_str ( include_str ! ( "../../models.json" ) ) . expect ( "valid models.json" ) ;
1108+ let model = model_catalog
1109+ . models
1110+ . iter_mut ( )
1111+ . find ( |model| model. slug == "gpt-5.1" )
1112+ . expect ( "gpt-5.1 exists in bundled models.json" ) ;
1113+ model. supports_reasoning_summaries = true ;
1114+ model. default_reasoning_summary = ReasoningSummary :: Detailed ;
1115+
1116+ let TestCodex { codex, .. } = test_codex ( )
1117+ . with_model ( "gpt-5.1" )
1118+ . with_config ( move |config| {
1119+ config. model_reasoning_summary = Some ( ReasoningSummary :: None ) ;
1120+ config. model_catalog = Some ( model_catalog) ;
1121+ } )
1122+ . build ( & server)
1123+ . await ?;
1124+
1125+ codex
1126+ . submit ( Op :: UserInput {
1127+ items : vec ! [ UserInput :: Text {
1128+ text: "hello" . into( ) ,
1129+ text_elements: Vec :: new( ) ,
1130+ } ] ,
1131+ final_output_json_schema : None ,
1132+ } )
1133+ . await
1134+ . unwrap ( ) ;
1135+
1136+ wait_for_event ( & codex, |ev| matches ! ( ev, EventMsg :: TurnComplete ( _) ) ) . await ;
1137+
1138+ let request_body = resp_mock. single_request ( ) . body_json ( ) ;
1139+ pretty_assertions:: assert_eq!(
1140+ request_body
1141+ . get( "reasoning" )
1142+ . and_then( |reasoning| reasoning. get( "summary" ) ) ,
1143+ None
1144+ ) ;
1145+
1146+ Ok ( ( ) )
1147+ }
1148+
10921149#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
10931150async fn includes_default_verbosity_in_request ( ) -> anyhow:: Result < ( ) > {
10941151 skip_if_no_network ! ( Ok ( ( ) ) ) ;
@@ -1441,7 +1498,14 @@ async fn azure_responses_request_includes_store_and_reasoning_ids() {
14411498 } ) ;
14421499
14431500 let mut stream = client_session
1444- . stream ( & prompt, & model_info, & otel_manager, effort, summary, None )
1501+ . stream (
1502+ & prompt,
1503+ & model_info,
1504+ & otel_manager,
1505+ effort,
1506+ summary. unwrap_or ( ReasoningSummary :: Auto ) ,
1507+ None ,
1508+ )
14451509 . await
14461510 . expect ( "responses stream to start" ) ;
14471511
0 commit comments