fix: --search shouldn't show deprecation message (#6180)

Use the new feature flags instead of the old config.
This commit is contained in:
Ahmed Ibrahim
2025-11-03 16:11:50 -08:00
committed by GitHub
parent 1e0e553304
commit e658c6c73b
4 changed files with 20 additions and 5 deletions

1
codex-rs/Cargo.lock generated
View File

@@ -992,6 +992,7 @@ dependencies = [
"supports-color", "supports-color",
"tempfile", "tempfile",
"tokio", "tokio",
"toml",
] ]
[[package]] [[package]]

View File

@@ -39,6 +39,7 @@ ctor = { workspace = true }
owo-colors = { workspace = true } owo-colors = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }
supports-color = { workspace = true } supports-color = { workspace = true }
toml = { workspace = true }
tokio = { workspace = true, features = [ tokio = { workspace = true, features = [
"io-std", "io-std",
"macros", "macros",

View File

@@ -510,15 +510,21 @@ async fn cli_main(codex_linux_sandbox_exe: Option<PathBuf>) -> anyhow::Result<()
Some(Subcommand::Features(FeaturesCli { sub })) => match sub { Some(Subcommand::Features(FeaturesCli { sub })) => match sub {
FeaturesSubcommand::List => { FeaturesSubcommand::List => {
// Respect root-level `-c` overrides plus top-level flags like `--profile`. // Respect root-level `-c` overrides plus top-level flags like `--profile`.
let cli_kv_overrides = root_config_overrides let mut cli_kv_overrides = root_config_overrides
.parse_overrides() .parse_overrides()
.map_err(anyhow::Error::msg)?; .map_err(anyhow::Error::msg)?;
// Honor `--search` via the new feature toggle.
if interactive.web_search {
cli_kv_overrides.push((
"features.web_search_request".to_string(),
toml::Value::Boolean(true),
));
}
// Thread through relevant top-level flags (at minimum, `--profile`). // Thread through relevant top-level flags (at minimum, `--profile`).
// Also honor `--search` since it maps to a feature toggle.
let overrides = ConfigOverrides { let overrides = ConfigOverrides {
config_profile: interactive.config_profile.clone(), config_profile: interactive.config_profile.clone(),
tools_web_search_request: interactive.web_search.then_some(true),
..Default::default() ..Default::default()
}; };

View File

@@ -94,7 +94,7 @@ use std::io::Write as _;
// (tests access modules directly within the crate) // (tests access modules directly within the crate)
pub async fn run_main( pub async fn run_main(
cli: Cli, mut cli: Cli,
codex_linux_sandbox_exe: Option<PathBuf>, codex_linux_sandbox_exe: Option<PathBuf>,
) -> std::io::Result<AppExitInfo> { ) -> std::io::Result<AppExitInfo> {
let (sandbox_mode, approval_policy) = if cli.full_auto { let (sandbox_mode, approval_policy) = if cli.full_auto {
@@ -114,6 +114,13 @@ pub async fn run_main(
) )
}; };
// Map the legacy --search flag to the new feature toggle.
if cli.web_search {
cli.config_overrides
.raw_overrides
.push("features.web_search_request=true".to_string());
}
// When using `--oss`, let the bootstrapper pick the model (defaulting to // When using `--oss`, let the bootstrapper pick the model (defaulting to
// gpt-oss:20b) and ensure it is present locally. Also, force the builtin // gpt-oss:20b) and ensure it is present locally. Also, force the builtin
// `oss` model provider. // `oss` model provider.
@@ -149,7 +156,7 @@ pub async fn run_main(
compact_prompt: None, compact_prompt: None,
include_apply_patch_tool: None, include_apply_patch_tool: None,
show_raw_agent_reasoning: cli.oss.then_some(true), show_raw_agent_reasoning: cli.oss.then_some(true),
tools_web_search_request: cli.web_search.then_some(true), tools_web_search_request: None,
experimental_sandbox_command_assessment: None, experimental_sandbox_command_assessment: None,
additional_writable_roots: additional_dirs, additional_writable_roots: additional_dirs,
}; };