Fix codex exec --profile handling (#14524)

PR #14005 introduced a regression whereby `codex exec --profile`
overrides were dropped when starting or resuming a thread. That causes
the thread to miss profile-scoped settings like
`model_instructions_file`.

This PR preserve the active profile in the thread start/resume config
overrides so the
app-server rebuild sees the same profile that exec resolved. 

Fixes #14515
This commit is contained in:
Eric Traut
2026-03-12 17:34:25 -06:00
committed by GitHub
parent 53d5972226
commit d32820ab07
2 changed files with 79 additions and 0 deletions

View File

@@ -77,6 +77,7 @@ use codex_utils_oss::get_default_model_for_oss_provider;
use event_processor_with_human_output::EventProcessorWithHumanOutput;
use event_processor_with_jsonl_output::EventProcessorWithJsonOutput;
use serde_json::Value;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::IsTerminal;
@@ -914,6 +915,7 @@ fn thread_start_params_from_config(config: &Config) -> ThreadStartParams {
cwd: Some(config.cwd.to_string_lossy().to_string()),
approval_policy: Some(config.permissions.approval_policy.value().into()),
sandbox: sandbox_mode_from_policy(config.permissions.sandbox_policy.get()),
config: config_request_overrides_from_config(config),
ephemeral: Some(config.ephemeral),
..ThreadStartParams::default()
}
@@ -928,10 +930,18 @@ fn thread_resume_params_from_config(config: &Config, path: Option<PathBuf>) -> T
cwd: Some(config.cwd.to_string_lossy().to_string()),
approval_policy: Some(config.permissions.approval_policy.value().into()),
sandbox: sandbox_mode_from_policy(config.permissions.sandbox_policy.get()),
config: config_request_overrides_from_config(config),
..ThreadResumeParams::default()
}
}
fn config_request_overrides_from_config(config: &Config) -> Option<HashMap<String, Value>> {
config
.active_profile
.as_ref()
.map(|profile| HashMap::from([("profile".to_string(), Value::String(profile.clone()))]))
}
async fn send_request_with_response<T>(
client: &InProcessAppServerClient,
request: ClientRequest,