Retire the personality feature flag and document deprecated settings (#45809)

## 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
This commit is contained in:
rhan-oai authored and copyberry committed 2026-09-15 23:39:40 +00:00
1 parent 4d2807023a
commit 883af106b9
54 files changed
+389 -264

No files matched your search

@@ -487,6 +487,5 @@ fn create_config_toml(codex_home: &std::path::Path, server_uri: &str) -> std::io
MockResponsesConfig::new(server_uri)
.with_model(REQUESTED_MODEL)
.disable_feature(Feature::RemoteModels)
.enable_feature(Feature::Personality)
.write(codex_home)
}
@@ -1178,13 +1178,9 @@ stream_max_retries = 0
async fn thread_resume_preserves_goal_first_and_fork_approvals_reviewer() -> Result<()> {
let server = create_mock_responses_server_repeating_assistant("Done").await;
let codex_home = TempDir::new()?;
mock_responses_config(&server.uri()).write(codex_home.path())?;
let config_path = codex_home.path().join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
std::fs::write(
&config_path,
config.replace("personality = true\n", "personality = true\ngoals = true\n"),
)?;
mock_responses_config(&server.uri())
.enable_feature(Feature::Goals)
.write(codex_home.path())?;
let (thread_id, fork_thread_id) = {
let mut mcp = TestAppServer::builder()
@@ -1271,6 +1267,7 @@ async fn thread_resume_preserves_goal_first_and_fork_approvals_reviewer() -> Res
(thread.id, fork_thread.id)
};
let config_path = codex_home.path().join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
std::fs::write(
config_path,
@@ -1943,13 +1940,9 @@ fn write_dev_permission_config(
async fn thread_goal_get_rejects_unmaterialized_thread() -> Result<()> {
let server = create_mock_responses_server_repeating_assistant("Done").await;
let codex_home = TempDir::new()?;
mock_responses_config(&server.uri()).write(codex_home.path())?;
let config_path = codex_home.path().join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
std::fs::write(
&config_path,
config.replace("personality = true\n", "personality = true\ngoals = true\n"),
)?;
mock_responses_config(&server.uri())
.enable_feature(Feature::Goals)
.write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -2244,13 +2237,9 @@ async fn goal_first_live_thread_appears_in_state_db_thread_list() -> Result<()>
let server = create_mock_responses_server_repeating_assistant("Done").await;
let codex_home = TempDir::new()?;
let codex_home_path = normalized_existing_path(codex_home.path())?;
mock_responses_config(&server.uri()).write(&codex_home_path)?;
let config_path = codex_home_path.join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
std::fs::write(
&config_path,
config.replace("personality = true\n", "personality = true\ngoals = true\n"),
)?;
mock_responses_config(&server.uri())
.enable_feature(Feature::Goals)
.write(&codex_home_path)?;
let sqlite_home = codex_home_path
.as_path()
@@ -3000,13 +2989,9 @@ async fn thread_resume_keeps_tool_paused_goal_paused() -> Result<()> {
])
.await;
let codex_home = TempDir::new()?;
mock_responses_config(&server.uri()).write(codex_home.path())?;
let config_path = codex_home.path().join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
std::fs::write(
&config_path,
config.replace("personality = true\n", "personality = true\ngoals = true\n"),
)?;
mock_responses_config(&server.uri())
.enable_feature(Feature::Goals)
.write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -3088,14 +3073,10 @@ async fn thread_resume_keeps_tool_paused_goal_paused() -> Result<()> {
async fn thread_goal_set_enforces_configured_maximum_token_budget() -> Result<()> {
let server = create_mock_responses_server_repeating_assistant("Done").await;
let codex_home = TempDir::new()?;
mock_responses_config(&server.uri()).write(codex_home.path())?;
let config_path = codex_home.path().join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
let config = config.replace("personality = true\n", "personality = true\ngoals = true\n");
std::fs::write(
config_path,
format!("{config}\n[goals]\nmax_goal_token_budget = 200\n"),
)?;
mock_responses_config(&server.uri())
.enable_feature(Feature::Goals)
.with_extra_config("[goals]\nmax_goal_token_budget = 200")
.write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -3185,13 +3166,9 @@ async fn thread_goal_set_enforces_configured_maximum_token_budget() -> Result<()
async fn thread_goal_set_preserves_budget_limited_same_objective() -> Result<()> {
let server = create_mock_responses_server_repeating_assistant("Done").await;
let codex_home = TempDir::new()?;
mock_responses_config(&server.uri()).write(codex_home.path())?;
let config_path = codex_home.path().join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
std::fs::write(
&config_path,
config.replace("personality = true\n", "personality = true\ngoals = true\n"),
)?;
mock_responses_config(&server.uri())
.enable_feature(Feature::Goals)
.write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -3275,13 +3252,9 @@ async fn thread_goal_set_preserves_budget_limited_same_objective() -> Result<()>
async fn thread_goal_set_persists_resumable_stopped_statuses() -> Result<()> {
let server = create_mock_responses_server_repeating_assistant("Done").await;
let codex_home = TempDir::new()?;
mock_responses_config(&server.uri()).write(codex_home.path())?;
let config_path = codex_home.path().join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
std::fs::write(
&config_path,
config.replace("personality = true\n", "personality = true\ngoals = true\n"),
)?;
mock_responses_config(&server.uri())
.enable_feature(Feature::Goals)
.write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -3357,13 +3330,9 @@ async fn thread_goal_set_persists_resumable_stopped_statuses() -> Result<()> {
async fn thread_goal_set_edits_objective_without_resetting_usage() -> Result<()> {
let server = create_mock_responses_server_repeating_assistant("Done").await;
let codex_home = TempDir::new()?;
mock_responses_config(&server.uri()).write(codex_home.path())?;
let config_path = codex_home.path().join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
std::fs::write(
&config_path,
config.replace("personality = true\n", "personality = true\ngoals = true\n"),
)?;
mock_responses_config(&server.uri())
.enable_feature(Feature::Goals)
.write(codex_home.path())?;
let thread_id = create_fake_rollout(
codex_home.path(),
"2025-01-05T12-00-00",
@@ -3686,14 +3655,9 @@ async fn thread_goal_lifecycle_emits_analytics_and_clear_deletes_goal() -> Resul
.await;
let codex_home = TempDir::new()?;
mock_responses_config(&server.uri())
.enable_feature(Feature::Goals)
.with_root_config(&format!(r#"chatgpt_base_url = "{}""#, server.uri()))
.write(codex_home.path())?;
let config_path = codex_home.path().join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
std::fs::write(
&config_path,
config.replace("personality = true\n", "personality = true\ngoals = true\n"),
)?;
mount_analytics_capture(&server, codex_home.path()).await?;
let mut mcp = TestAppServer::builder()
@@ -6263,9 +6227,7 @@ async fn thread_resume_accepts_deprecated_personality_override() -> Result<()> {
}
fn mock_responses_config(server_uri: &str) -> MockResponsesConfig {
MockResponsesConfig::new(server_uri)
.with_model("gpt-5.4")
.enable_feature(Feature::Personality)
MockResponsesConfig::new(server_uri).with_model("gpt-5.4")
}
#[allow(dead_code)]
@@ -842,9 +842,7 @@ async fn turn_start_sends_originator_header() -> Result<()> {
let server = create_mock_responses_server_sequence_unchecked(responses).await;
let codex_home = TempDir::new()?;
MockResponsesConfig::new(&server.uri())
.enable_feature(Feature::Personality)
.write(codex_home.path())?;
MockResponsesConfig::new(&server.uri()).write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -911,9 +909,7 @@ async fn turn_start_emits_user_message_item_with_text_elements() -> Result<()> {
let server = create_mock_responses_server_sequence_unchecked(responses).await;
let codex_home = TempDir::new()?;
MockResponsesConfig::new(&server.uri())
.enable_feature(Feature::Personality)
.write(codex_home.path())?;
MockResponsesConfig::new(&server.uri()).write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -989,9 +985,7 @@ async fn turn_start_emits_thread_scoped_warning_notification_for_trimmed_skills(
let server = create_mock_responses_server_sequence_unchecked(responses).await;
let codex_home = TempDir::new()?;
MockResponsesConfig::new(&server.uri())
.enable_feature(Feature::Personality)
.write(codex_home.path())?;
MockResponsesConfig::new(&server.uri()).write(codex_home.path())?;
write_models_cache(codex_home.path()).await?;
let cache_path = codex_home.path().join("models_cache.json");
let mut cache: serde_json::Value =
@@ -1826,9 +1820,7 @@ async fn turn_start_accepts_text_at_limit_with_mention_item() -> Result<()> {
let server = create_mock_responses_server_sequence_unchecked(responses).await;
let codex_home = TempDir::new()?;
MockResponsesConfig::new(&server.uri())
.enable_feature(Feature::Personality)
.write(codex_home.path())?;
MockResponsesConfig::new(&server.uri()).write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -1876,9 +1868,7 @@ async fn turn_start_accepts_text_at_limit_with_mention_item() -> Result<()> {
#[tokio::test]
async fn turn_start_rejects_combined_oversized_text_input() -> Result<()> {
let codex_home = TempDir::new()?;
MockResponsesConfig::new("http://localhost/unused")
.enable_feature(Feature::Personality)
.write(codex_home.path())?;
MockResponsesConfig::new("http://localhost/unused").write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -1969,9 +1959,7 @@ async fn turn_start_rejects_combined_oversized_text_input() -> Result<()> {
#[tokio::test]
async fn turn_start_rejects_invalid_permission_selection_before_starting_turn() -> Result<()> {
let codex_home = TempDir::new()?;
MockResponsesConfig::new("http://localhost/unused")
.enable_feature(Feature::Personality)
.write(codex_home.path())?;
MockResponsesConfig::new("http://localhost/unused").write(codex_home.path())?;
std::fs::write(
codex_home.path().join("managed_config.toml"),
"sandbox_mode = \"read-only\"\n",
@@ -2403,9 +2391,7 @@ async fn turn_start_emits_notifications_and_accepts_model_override() -> Result<(
let server = create_mock_responses_server_sequence_unchecked(responses).await;
let codex_home = TempDir::new()?;
MockResponsesConfig::new(&server.uri())
.enable_feature(Feature::Personality)
.write(codex_home.path())?;
MockResponsesConfig::new(&server.uri()).write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -2679,9 +2665,7 @@ async fn turn_start_accepts_deprecated_personality_override_v2() -> Result<()> {
let response_mock = responses::mount_sse_once(&server, body).await;
let codex_home = TempDir::new()?;
MockResponsesConfig::new(&server.uri())
.enable_feature(Feature::Personality)
.write(codex_home.path())?;
MockResponsesConfig::new(&server.uri()).write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -2892,9 +2876,7 @@ async fn turn_start_ignores_personality_change_mid_thread_v2() -> Result<()> {
let response_mock = responses::mount_sse_sequence(&server, vec![sse1, sse2]).await;
let codex_home = TempDir::new()?;
MockResponsesConfig::new(&server.uri())
.enable_feature(Feature::Personality)
.write(codex_home.path())?;
MockResponsesConfig::new(&server.uri()).write(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -5762,9 +5744,7 @@ async fn turn_start_with_elevated_override_does_not_persist_project_trust() -> R
let server = create_mock_responses_server_sequence_unchecked(responses).await;
let codex_home = TempDir::new()?;
MockResponsesConfig::new(&server.uri())
.enable_feature(Feature::Personality)
.write(codex_home.path())?;
MockResponsesConfig::new(&server.uri()).write(codex_home.path())?;
let workspace = TempDir::new()?;