mirror of
https://github.com/openai/codex.git
synced 2026-10-18 17:18:52 +00:00
## What changed - Accept and ignore `features.personality` in user configuration, profiles, and managed requirements. - Remove feature gating from `personality = "none"`, which strips the literal `# Personality` section when preparing model catalog instructions. Preserve explicit base instructions and existing thread instructions. - Document deprecated personality fields in configuration, app-server schemas, and the Python SDK: `friendly` and `pragmatic` no longer select a style, and `supportsPersonality` is always `false`. ## Testing Add regression coverage for ignored legacy flag values and managed requirements, personality opt-out behavior with the flag absent or set to either value, role overrides, and preservation of explicit base instructions, including empty strings. GitOrigin-RevId: 4e12c66b42bfc59d6f151a5b3c28fadc6654ae99
70 lines
2.6 KiB
Rust
70 lines
2.6 KiB
Rust
use super::*;
|
|
use tempfile::TempDir;
|
|
|
|
#[test]
|
|
fn mock_responses_config_composes_model_provider_features_and_extra_tables() {
|
|
let home = TempDir::new().expect("temporary CODEX_HOME");
|
|
MockResponsesConfig::new("http://127.0.0.1:1234")
|
|
.with_model("custom-model")
|
|
.with_model_provider("openai-custom")
|
|
.with_provider_name("OpenAI")
|
|
.with_provider_base_url("http://127.0.0.1:1234/api/codex")
|
|
.with_approval_policy("on-request")
|
|
.with_sandbox_mode("workspace-write")
|
|
.enable_feature(Feature::FastMode)
|
|
.disable_feature(Feature::ShellSnapshot)
|
|
.with_root_config("chatgpt_base_url = \"http://127.0.0.1:1234\"")
|
|
.with_provider_config("requires_openai_auth = true")
|
|
.with_extra_config("[extra]\nenabled = true")
|
|
.write(home.path())
|
|
.expect("write composable mock Responses config");
|
|
|
|
let config =
|
|
std::fs::read_to_string(home.path().join("config.toml")).expect("read config.toml");
|
|
for expected in [
|
|
"model = \"custom-model\"",
|
|
"approval_policy = \"on-request\"",
|
|
"sandbox_mode = \"workspace-write\"",
|
|
"chatgpt_base_url = \"http://127.0.0.1:1234\"",
|
|
"model_provider = \"openai-custom\"",
|
|
"shell_snapshot = false",
|
|
"fast_mode = true",
|
|
"[model_providers.openai-custom]\nname = \"OpenAI\"",
|
|
"base_url = \"http://127.0.0.1:1234/api/codex\"",
|
|
"requires_openai_auth = true",
|
|
"[extra]\nenabled = true",
|
|
] {
|
|
assert!(config.contains(expected), "config is missing {expected}");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn legacy_mock_responses_writer_preserves_provider_auth_and_feature_overrides() {
|
|
let home = TempDir::new().expect("temporary CODEX_HOME");
|
|
write_mock_responses_config_toml(
|
|
home.path(),
|
|
"http://127.0.0.1:1234",
|
|
&BTreeMap::from([(Feature::FastMode, true), (Feature::ShellSnapshot, false)]),
|
|
/*auto_compact_limit*/ 321,
|
|
Some(true),
|
|
"openai",
|
|
"compact this",
|
|
)
|
|
.expect("write legacy-compatible mock Responses config");
|
|
|
|
let config =
|
|
std::fs::read_to_string(home.path().join("config.toml")).expect("read config.toml");
|
|
for expected in [
|
|
"compact_prompt = \"compact this\"",
|
|
"model_auto_compact_token_limit = 321",
|
|
"openai_base_url = \"http://127.0.0.1:1234/v1\"",
|
|
"shell_snapshot = false",
|
|
"fast_mode = true",
|
|
"[model_providers.openai]\nname = \"OpenAI\"",
|
|
"supports_websockets = false",
|
|
"requires_openai_auth = true",
|
|
] {
|
|
assert!(config.contains(expected), "config is missing {expected}");
|
|
}
|
|
}
|