mirror of
https://github.com/openai/codex.git
synced 2026-10-18 17:18:52 +00:00
unknown models
This commit is contained in:
+1
-1
@@ -249,7 +249,7 @@ Controls whether to expose the experimental plan tool (named `update_plan`) to t
|
||||
|
||||
Default behavior:
|
||||
- For known models (anything hardcoded in the models list), this is disabled by default.
|
||||
- For unknown models (not in the known list), this is enabled by default so new models get the feature without a CLI update.
|
||||
- For unknown models whose name starts with "gpt-", this is enabled by default so new GPT-family models get the feature without a CLI update.
|
||||
|
||||
When enabled, the model can call `update_plan` to keep an up-to-date, step-by-step plan for the task and Codex will render plan updates in the UI. When disabled, the tool is not advertised to the model and the “Plan updates” section is omitted from the prompt; any unsolicited `update_plan` calls will be treated as unsupported.
|
||||
|
||||
|
||||
@@ -480,6 +480,7 @@ impl Config {
|
||||
});
|
||||
|
||||
let experimental_resume = cfg.experimental_resume;
|
||||
let is_unknown_gpt = openai_model_info.is_none() && model.starts_with("gpt-");
|
||||
|
||||
// Load base instructions override from a file if specified. If the
|
||||
// path is relative, resolve it against the effective cwd so the
|
||||
@@ -531,7 +532,7 @@ impl Config {
|
||||
|
||||
model_supports_reasoning_summaries: cfg
|
||||
.model_supports_reasoning_summaries
|
||||
.unwrap_or(false),
|
||||
.unwrap_or(is_unknown_gpt),
|
||||
|
||||
chatgpt_base_url: config_profile
|
||||
.chatgpt_base_url
|
||||
@@ -541,7 +542,7 @@ impl Config {
|
||||
experimental_resume,
|
||||
include_plan_tool: include_plan_tool
|
||||
.or(cfg.experimental_include_plan_tool)
|
||||
.unwrap_or_else(|| openai_model_info.is_none()),
|
||||
.unwrap_or(is_unknown_gpt),
|
||||
internal_originator: cfg.internal_originator,
|
||||
};
|
||||
Ok(config)
|
||||
@@ -655,6 +656,64 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[test]
|
||||
fn test_plan_and_reasoning_defaults_known_vs_unknown() -> std::io::Result<()> {
|
||||
let fixture = create_test_fixture()?;
|
||||
|
||||
// Unknown GPT-like model -> defaults ON for plan tool and reasoning summaries override.
|
||||
let unknown_gpt_overrides = ConfigOverrides {
|
||||
model: Some("gpt-unknown-2025".to_string()),
|
||||
cwd: Some(fixture.cwd()),
|
||||
..Default::default()
|
||||
};
|
||||
let unknown_gpt_cfg = Config::load_from_base_config_with_overrides(
|
||||
fixture.cfg.clone(),
|
||||
unknown_gpt_overrides,
|
||||
fixture.codex_home(),
|
||||
)?;
|
||||
assert!(unknown_gpt_cfg.include_plan_tool, "plan tool should default to ON for unknown GPT-like models");
|
||||
assert!(unknown_gpt_cfg.model_supports_reasoning_summaries, "reasoning summaries should default to ON for unknown GPT-like models");
|
||||
|
||||
// Unknown non-GPT model -> defaults OFF for both.
|
||||
let unknown_non_gpt_overrides = ConfigOverrides {
|
||||
model: Some("my-new-model".to_string()),
|
||||
cwd: Some(fixture.cwd()),
|
||||
..Default::default()
|
||||
};
|
||||
let unknown_non_gpt_cfg = Config::load_from_base_config_with_overrides(
|
||||
fixture.cfg.clone(),
|
||||
unknown_non_gpt_overrides,
|
||||
fixture.codex_home(),
|
||||
)?;
|
||||
assert!(
|
||||
!unknown_non_gpt_cfg.include_plan_tool,
|
||||
"plan tool should default to OFF for unknown non-GPT models"
|
||||
);
|
||||
assert!(
|
||||
!unknown_non_gpt_cfg.model_supports_reasoning_summaries,
|
||||
"reasoning summaries should default to OFF for unknown non-GPT models"
|
||||
);
|
||||
|
||||
// Known model -> defaults OFF for plan tool and reasoning summaries override value.
|
||||
let known_overrides = ConfigOverrides {
|
||||
model: Some("gpt-3.5-turbo".to_string()),
|
||||
cwd: Some(fixture.cwd()),
|
||||
..Default::default()
|
||||
};
|
||||
let known_cfg = Config::load_from_base_config_with_overrides(
|
||||
fixture.cfg.clone(),
|
||||
known_overrides,
|
||||
fixture.codex_home(),
|
||||
)?;
|
||||
assert!(!known_cfg.include_plan_tool, "plan tool should default to OFF for known models");
|
||||
assert!(
|
||||
!known_cfg.model_supports_reasoning_summaries,
|
||||
"reasoning summaries override should default to OFF for known models"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_toml_parsing() {
|
||||
let history_with_persistence = r#"
|
||||
|
||||
Reference in New Issue
Block a user