fix: Codex PTY launch forwards profile model as argv override

- injecte model et model_reasoning_effort du profil via -c dans argv
- remplace le modèle TUI stale en config.toml
- aligne PTY/interactif sur le comportement déjà garanti par CodexExecSession
- test unitaire codex_pty_launch_forwards_profile_model_as_config_override
This commit is contained in:
2026-08-02 18:02:00 +02:00
parent dcc7a6f216
commit 7c2bd227d2
2 changed files with 103 additions and 0 deletions

View File

@ -3842,6 +3842,60 @@ async fn codex_projection_folds_args_into_spawn_spec() {
);
}
#[tokio::test]
async fn codex_pty_launch_forwards_profile_model_as_config_override() {
let profile = codex_profile()
.with_projector(ProjectorKey::Codex)
.with_model("gpt-5.4")
.with_model_reasoning_effort("medium");
let (launch, agent, fs, pty, _s) = launch_with_projection(
profile,
Some(ContextInjectionPlan::File {
target: "AGENTS.md".to_owned(),
}),
Some(full_registry()),
None,
);
let run_dir = format!("/home/me/proj/.ideai/run/{}", agent.id);
let cfg_path = format!("{run_dir}{CODEX_CONFIG_REL}");
fs.seed_read(
&cfg_path,
"model = \"gpt-5.6-sol\"\n[mcp_servers.idea]\ncommand = \"idea\"\n",
);
launch
.execute(launch_input(agent.id))
.await
.expect("launch");
let args = &pty.spawns()[0].args;
assert!(
args.windows(2)
.any(|w| w == ["-c".to_owned(), "model=\"gpt-5.4\"".to_owned()]),
"PTY Codex launch must override stale TUI model from config.toml, got {args:?}"
);
assert!(
args.windows(2).any(|w| w
== [
"-c".to_owned(),
"model_reasoning_effort=\"medium\"".to_owned()
]),
"PTY Codex launch must also forward reasoning effort, got {args:?}"
);
let toml = String::from_utf8(
fs.writes_ending_with(CODEX_CONFIG_REL)
.last()
.expect("a codex config write")
.1
.clone(),
)
.unwrap();
assert!(
toml.contains("model = \"gpt-5.6-sol\""),
"the unmanaged stale TUI model may remain in config.toml; argv must take precedence: {toml}"
);
}
// ---- (5) MCP decoupling — THE key case of the lot ---------------------------
/// (5) A Codex profile with **no MCP capability** still gets its sandbox projected