Files
codex/codex-rs/models-manager/src/model_info_overrides_tests.rs
T
rhan-oai eb7bd64ef9 Remove retired model entries while preserving migration prompts (#44250)
## Why

Saved model selections can outlive their bundled catalog entries and still need migration guidance.

## What changed

- Remove `gpt-5.2` and `gpt-5.4-mini` from the bundled model catalog.
- Preserve migration from saved `gpt-5.4-mini` selections to `gpt-5.6-luna` when the old model is absent, while respecting catalog-provided migration metadata.
- Update tests and snapshots to use current models or explicit test fixtures, and remove the obsolete prompt fixture.

## Testing

Extend migration tests to cover catalog metadata precedence, saved selections, replacement model and reasoning-effort persistence, acknowledged prompts, and missing or hidden migration targets.

GitOrigin-RevId: 82beea504cc4a15699677c28a61ec0939af3069c
2026-09-09 17:56:33 +00:00

46 lines
1.4 KiB
Rust

use crate::ModelsManagerConfig;
use crate::manager::ModelsManager;
use codex_protocol::openai_models::TruncationPolicyConfig;
use pretty_assertions::assert_eq;
use tempfile::TempDir;
use super::TestModelsEndpoint;
use super::openai_manager_for_tests;
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn offline_model_info_without_tool_output_override() {
let codex_home = TempDir::new().expect("create temp dir");
let config = ModelsManagerConfig::default();
let manager = openai_manager_for_tests(
codex_home.path().to_path_buf(),
TestModelsEndpoint::new(Vec::new()),
);
let model_info = manager.get_model_info("unknown-model", &config).await;
assert_eq!(
model_info.truncation_policy,
TruncationPolicyConfig::bytes(/*limit*/ 10_000)
);
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn offline_model_info_with_tool_output_override() {
let codex_home = TempDir::new().expect("create temp dir");
let config = ModelsManagerConfig {
tool_output_token_limit: Some(123),
..Default::default()
};
let manager = openai_manager_for_tests(
codex_home.path().to_path_buf(),
TestModelsEndpoint::new(Vec::new()),
);
let model_info = manager.get_model_info("gpt-5.5", &config).await;
assert_eq!(
model_info.truncation_policy,
TruncationPolicyConfig::tokens(/*limit*/ 123)
);
}