Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

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

Ahmed Ibrahime658c6c73bd1
diff --git a/codex-rs/Cargo.lock b/codex-rs/Cargo.lock
index 504b37be1d..4961486e65 100644
--- a/codex-rs/Cargo.lock
+++ b/codex-rs/Cargo.lock
@@ -992,6 +992,7 @@ dependencies = [
"supports-color",
"tempfile",
"tokio",
+ "toml",
]
[[package]]
diff --git a/codex-rs/cli/Cargo.toml b/codex-rs/cli/Cargo.toml
index b5c5b33b8c..041644b34d 100644
--- a/codex-rs/cli/Cargo.toml
+++ b/codex-rs/cli/Cargo.toml
@@ -39,6 +39,7 @@ ctor = { workspace = true }
owo-colors = { workspace = true }
serde_json = { workspace = true }
supports-color = { workspace = true }
+toml = { workspace = true }
tokio = { workspace = true, features = [
"io-std",
"macros",
diff --git a/codex-rs/cli/src/main.rs b/codex-rs/cli/src/main.rs
index 9b2d106c0f..929fd9e785 100644
--- a/codex-rs/cli/src/main.rs
+++ b/codex-rs/cli/src/main.rs
@@ -510,15 +510,21 @@ async fn cli_main(codex_linux_sandbox_exe: Option<PathBuf>) -> anyhow::Result<()
Some(Subcommand::Features(FeaturesCli { sub })) => match sub {
FeaturesSubcommand::List => {
// 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()
.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`).
- // Also honor `--search` since it maps to a feature toggle.
let overrides = ConfigOverrides {
config_profile: interactive.config_profile.clone(),
- tools_web_search_request: interactive.web_search.then_some(true),
..Default::default()
};
diff --git a/codex-rs/tui/src/lib.rs b/codex-rs/tui/src/lib.rs
index 67df856241..99312ec198 100644
--- a/codex-rs/tui/src/lib.rs
+++ b/codex-rs/tui/src/lib.rs
@@ -94,7 +94,7 @@ use std::io::Write as _;
// (tests access modules directly within the crate)
pub async fn run_main(
- cli: Cli,
+ mut cli: Cli,
codex_linux_sandbox_exe: Option<PathBuf>,
) -> std::io::Result<AppExitInfo> {
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
// gpt-oss:20b) and ensure it is present locally. Also, force the built‑in
// `oss` model provider.
@@ -149,7 +156,7 @@ pub async fn run_main(
compact_prompt: None,
include_apply_patch_tool: None,
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,
additional_writable_roots: additional_dirs,
};