Skip to content

Commit 4477780

Browse files
authored
fix: --search shouldn't show deprecation message (openai#6180)
Use the new feature flags instead of the old config.
1 parent de08b8a commit 4477780

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

codex-rs/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ ctor = { workspace = true }
3939
owo-colors = { workspace = true }
4040
serde_json = { workspace = true }
4141
supports-color = { workspace = true }
42+
toml = { workspace = true }
4243
tokio = { workspace = true, features = [
4344
"io-std",
4445
"macros",

codex-rs/cli/src/main.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,21 @@ async fn cli_main(codex_linux_sandbox_exe: Option<PathBuf>) -> anyhow::Result<()
510510
Some(Subcommand::Features(FeaturesCli { sub })) => match sub {
511511
FeaturesSubcommand::List => {
512512
// Respect root-level `-c` overrides plus top-level flags like `--profile`.
513-
let cli_kv_overrides = root_config_overrides
513+
let mut cli_kv_overrides = root_config_overrides
514514
.parse_overrides()
515515
.map_err(anyhow::Error::msg)?;
516516

517+
// Honor `--search` via the new feature toggle.
518+
if interactive.web_search {
519+
cli_kv_overrides.push((
520+
"features.web_search_request".to_string(),
521+
toml::Value::Boolean(true),
522+
));
523+
}
524+
517525
// Thread through relevant top-level flags (at minimum, `--profile`).
518-
// Also honor `--search` since it maps to a feature toggle.
519526
let overrides = ConfigOverrides {
520527
config_profile: interactive.config_profile.clone(),
521-
tools_web_search_request: interactive.web_search.then_some(true),
522528
..Default::default()
523529
};
524530

codex-rs/tui/src/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ use std::io::Write as _;
9494
// (tests access modules directly within the crate)
9595

9696
pub async fn run_main(
97-
cli: Cli,
97+
mut cli: Cli,
9898
codex_linux_sandbox_exe: Option<PathBuf>,
9999
) -> std::io::Result<AppExitInfo> {
100100
let (sandbox_mode, approval_policy) = if cli.full_auto {
@@ -114,6 +114,13 @@ pub async fn run_main(
114114
)
115115
};
116116

117+
// Map the legacy --search flag to the new feature toggle.
118+
if cli.web_search {
119+
cli.config_overrides
120+
.raw_overrides
121+
.push("features.web_search_request=true".to_string());
122+
}
123+
117124
// When using `--oss`, let the bootstrapper pick the model (defaulting to
118125
// gpt-oss:20b) and ensure it is present locally. Also, force the built‑in
119126
// `oss` model provider.
@@ -149,7 +156,7 @@ pub async fn run_main(
149156
compact_prompt: None,
150157
include_apply_patch_tool: None,
151158
show_raw_agent_reasoning: cli.oss.then_some(true),
152-
tools_web_search_request: cli.web_search.then_some(true),
159+
tools_web_search_request: None,
153160
experimental_sandbox_command_assessment: None,
154161
additional_writable_roots: additional_dirs,
155162
};

0 commit comments

Comments
 (0)