Lightweight coding agent that runs in your terminal
Rust
Don't allow model_supports_reasoning_summaries to disable reasoning (#11833)
Eric Traut281b0eae8b5d
diff --git a/codex-rs/core/src/models_manager/model_info.rs b/codex-rs/core/src/models_manager/model_info.rsindex c5ad8899a1..19a945f951 100644--- a/codex-rs/core/src/models_manager/model_info.rs+++ b/codex-rs/core/src/models_manager/model_info.rs@@ -20,8 +20,10 @@ const LOCAL_PRAGMATIC_TEMPLATE: &str = "You are a deeply pragmatic, effective soconst PERSONALITY_PLACEHOLDER: &str = "{{ personality }}";pub(crate) fn with_config_overrides(mut model: ModelInfo, config: &Config) -> ModelInfo {- if let Some(supports_reasoning_summaries) = config.model_supports_reasoning_summaries {- model.supports_reasoning_summaries = supports_reasoning_summaries;+ if let Some(supports_reasoning_summaries) = config.model_supports_reasoning_summaries+ && supports_reasoning_summaries+ {+ model.supports_reasoning_summaries = true;}if let Some(context_window) = config.model_context_window {model.context_window = Some(context_window);@@ -100,3 +102,46 @@ fn local_personality_messages_for_slug(slug: &str) -> Option<ModelMessages> {_ => None,}}++#[cfg(test)]+mod tests {+ use super::*;+ use crate::config::test_config;+ use pretty_assertions::assert_eq;++ #[test]+ fn reasoning_summaries_override_true_enables_support() {+ let model = model_info_from_slug("unknown-model");+ let mut config = test_config();+ config.model_supports_reasoning_summaries = Some(true);++ let updated = with_config_overrides(model.clone(), &config);+ let mut expected = model;+ expected.supports_reasoning_summaries = true;++ assert_eq!(updated, expected);+ }++ #[test]+ fn reasoning_summaries_override_false_does_not_disable_support() {+ let mut model = model_info_from_slug("unknown-model");+ model.supports_reasoning_summaries = true;+ let mut config = test_config();+ config.model_supports_reasoning_summaries = Some(false);++ let updated = with_config_overrides(model.clone(), &config);++ assert_eq!(updated, model);+ }++ #[test]+ fn reasoning_summaries_override_false_is_noop_when_model_is_false() {+ let model = model_info_from_slug("unknown-model");+ let mut config = test_config();+ config.model_supports_reasoning_summaries = Some(false);++ let updated = with_config_overrides(model.clone(), &config);++ assert_eq!(updated, model);+ }+}