feat: reasoning effort as optional (#3527)

Allow the reasoning effort to be optional
This commit is contained in:
jif-oai
2025-09-12 12:06:33 -07:00
committed by GitHub
parent abdcb40f4c
commit c6fd056aa6
17 changed files with 95 additions and 61 deletions

View File

@@ -441,6 +441,7 @@ async fn chatgpt_auth_sends_correct_request() {
// Init session
let codex_home = TempDir::new().unwrap();
let mut config = load_default_config_for_test(&codex_home);
let include_reasoning = config.model_reasoning_effort.is_some();
config.model_provider = model_provider;
let conversation_manager = ConversationManager::with_auth(create_dummy_codex_auth());
let NewConversation {
@@ -482,10 +483,18 @@ async fn chatgpt_auth_sends_correct_request() {
);
assert_eq!(request_chatgpt_account_id.to_str().unwrap(), "account_id");
assert!(request_body["stream"].as_bool().unwrap());
assert_eq!(
request_body["include"][0].as_str().unwrap(),
"reasoning.encrypted_content"
);
if include_reasoning {
assert_eq!(
request_body["include"][0].as_str().unwrap(),
"reasoning.encrypted_content"
);
} else {
assert!(
request_body["include"]
.as_array()
.is_none_or(|items| items.is_empty())
);
}
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]

View File

@@ -36,7 +36,7 @@ async fn override_turn_context_does_not_persist_when_config_exists() {
approval_policy: None,
sandbox_policy: None,
model: Some("o3".to_string()),
effort: Some(ReasoningEffort::High),
effort: Some(Some(ReasoningEffort::High)),
summary: None,
})
.await
@@ -76,7 +76,7 @@ async fn override_turn_context_does_not_create_config_file() {
approval_policy: None,
sandbox_policy: None,
model: Some("o3".to_string()),
effort: Some(ReasoningEffort::Medium),
effort: Some(Some(ReasoningEffort::Medium)),
summary: None,
})
.await

View File

@@ -387,7 +387,7 @@ async fn overrides_turn_context_but_keeps_cached_prefix_and_key_constant() {
exclude_slash_tmp: true,
}),
model: Some("o3".to_string()),
effort: Some(ReasoningEffort::High),
effort: Some(Some(ReasoningEffort::High)),
summary: Some(ReasoningSummary::Detailed),
})
.await
@@ -519,7 +519,7 @@ async fn per_turn_overrides_keep_cached_prefix_and_key_constant() {
exclude_slash_tmp: true,
},
model: "o3".to_string(),
effort: ReasoningEffort::High,
effort: Some(ReasoningEffort::High),
summary: ReasoningSummary::Detailed,
})
.await