mirror of
https://github.com/openai/codex.git
synced 2026-11-10 08:43:33 +00:00
Make the update_plan tool opt-in (#41744)
## What changed - Default `tools.update_plan.enabled` to `false`; users can explicitly enable it to expose `update_plan`. - Remove bundled `update_plan` guidance from model, collaboration-mode, multi-agent, compaction, prewarm, and goal-continuation prompts when the tool is disabled. - Preserve custom base instructions, model catalog instructions, collaboration policies, and user goal text even when they mention planning or `update_plan`. ## Testing - Cover default and explicitly enabled tool registration, prompt consistency across request paths, and preservation of custom instructions. GitOrigin-RevId: a53964e6e72f98e2557dd3090fdb7caccb956527
This commit is contained in:
1 parent
b7cd519c76
commit
a9519cbcdd
31 files changed
+500
-71
No files matched your search
@@ -566,8 +566,8 @@ async fn load_config_resolves_non_prefixed_mcp_tool_servers() -> std::io::Result
|
||||
async fn load_config_resolves_update_plan_enabled() -> std::io::Result<()> {
|
||||
let codex_home = tempdir()?;
|
||||
for (config_toml, expected_enabled) in [
|
||||
("", true),
|
||||
("[tools.update_plan]", true),
|
||||
("", false),
|
||||
("[tools.update_plan]", false),
|
||||
("[tools.update_plan]\nenabled = false", false),
|
||||
("[tools.update_plan]\nenabled = true", true),
|
||||
] {
|
||||
@@ -11604,7 +11604,9 @@ max_concurrent_threads_per_session = 17
|
||||
for wait_agent_enabled in [true, false] {
|
||||
let mut config = config.clone();
|
||||
config.wait_agent_enabled = wait_agent_enabled;
|
||||
let usage_hints = resolve_usage_hints(&config, /*catalog*/ None);
|
||||
let usage_hints = resolve_usage_hints(
|
||||
&config, /*catalog*/ None, /*omit_update_plan_instructions*/ false,
|
||||
);
|
||||
for hint in [usage_hints.root, usage_hints.subagent] {
|
||||
let hint = hint.expect("default usage hints should be present").body();
|
||||
assert!(hint.contains(concurrency_guidance));
|
||||
@@ -11621,6 +11623,7 @@ max_concurrent_threads_per_session = 17
|
||||
root: Some(String::new()),
|
||||
subagent: Some(String::new()),
|
||||
}),
|
||||
/*omit_update_plan_instructions*/ false,
|
||||
);
|
||||
assert!(usage_hints.root.is_none() && usage_hints.subagent.is_none());
|
||||
}
|
||||
@@ -11628,12 +11631,12 @@ max_concurrent_threads_per_session = 17
|
||||
#[test]
|
||||
fn multi_agent_v2_model_override_exposure_preserves_configured_usage_hints() {
|
||||
let config_toml = toml::from_str(
|
||||
r#"[features.multi_agent_v2]
|
||||
r###"[features.multi_agent_v2]
|
||||
enabled = true
|
||||
root_agent_usage_hint_text = "Root guidance."
|
||||
subagent_usage_hint_text = "Subagent guidance."
|
||||
root_agent_usage_hint_text = "## Plan tool\nRoot guidance."
|
||||
subagent_usage_hint_text = "## `update_plan`\nSubagent guidance."
|
||||
expose_spawn_agent_model_overrides = true
|
||||
"#,
|
||||
"###,
|
||||
)
|
||||
.expect("multi-agent v2 config should parse");
|
||||
|
||||
@@ -11641,11 +11644,11 @@ expose_spawn_agent_model_overrides = true
|
||||
assert!(config.expose_spawn_agent_model_overrides);
|
||||
assert_eq!(
|
||||
config.root_agent_usage_hint_text.as_deref(),
|
||||
Some("Root guidance.")
|
||||
Some("## Plan tool\nRoot guidance.")
|
||||
);
|
||||
assert_eq!(
|
||||
config.subagent_usage_hint_text.as_deref(),
|
||||
Some("Subagent guidance.")
|
||||
Some("## `update_plan`\nSubagent guidance.")
|
||||
);
|
||||
let usage_hints = resolve_usage_hints(
|
||||
&config,
|
||||
@@ -11653,6 +11656,7 @@ expose_spawn_agent_model_overrides = true
|
||||
root: Some("Catalog root base.".to_string()),
|
||||
subagent: Some("Catalog subagent base.".to_string()),
|
||||
}),
|
||||
/*omit_update_plan_instructions*/ true,
|
||||
);
|
||||
assert_eq!(
|
||||
(
|
||||
@@ -11660,8 +11664,8 @@ expose_spawn_agent_model_overrides = true
|
||||
usage_hints.subagent.map(|hint| hint.body()),
|
||||
),
|
||||
(
|
||||
Some("Root guidance.".to_string()),
|
||||
Some("Subagent guidance.".to_string()),
|
||||
Some("## Plan tool\nRoot guidance.".to_string()),
|
||||
Some("## `update_plan`\nSubagent guidance.".to_string()),
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -11673,9 +11677,13 @@ fn multi_agent_v2_exposes_model_overrides_by_default() {
|
||||
|
||||
let mut config = resolve_multi_agent_v2_config(&config_toml);
|
||||
assert!(config.expose_spawn_agent_model_overrides);
|
||||
let usage_hints = resolve_usage_hints(&config, /*catalog*/ None);
|
||||
let usage_hints = resolve_usage_hints(
|
||||
&config, /*catalog*/ None, /*omit_update_plan_instructions*/ false,
|
||||
);
|
||||
config.expose_spawn_agent_model_overrides = false;
|
||||
let usage_hints_without_model_overrides = resolve_usage_hints(&config, /*catalog*/ None);
|
||||
let usage_hints_without_model_overrides = resolve_usage_hints(
|
||||
&config, /*catalog*/ None, /*omit_update_plan_instructions*/ false,
|
||||
);
|
||||
|
||||
for (hint, hint_without_model_overrides) in [
|
||||
(usage_hints.root, usage_hints_without_model_overrides.root),
|
||||
@@ -11790,6 +11798,7 @@ subagent_usage_hint_text = ""
|
||||
root: Some("catalog root".to_string()),
|
||||
subagent: Some("catalog subagent".to_string()),
|
||||
}),
|
||||
/*omit_update_plan_instructions*/ false,
|
||||
);
|
||||
assert_eq!(
|
||||
(
|
||||
|
||||
@@ -2641,7 +2641,7 @@ fn resolve_update_plan_enabled(config_toml: &ConfigToml) -> bool {
|
||||
.tools
|
||||
.as_ref()
|
||||
.and_then(|tools| tools.update_plan.as_ref())
|
||||
.is_none_or(|config| config.enabled)
|
||||
.is_some_and(|config| config.enabled)
|
||||
}
|
||||
|
||||
fn resolve_orchestrator_feature_enabled(
|
||||
|
||||
Reference in new issue
Block a user