Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions codex-rs/core/tests/suite/search_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn tool_search_output_tools(request: &ResponsesRequest, call_id: &str) -> Vec<Va
.unwrap_or_default()
}

fn configure_apps_without_tool_search(config: &mut Config, apps_base_url: &str) {
fn configure_search_capable_apps(config: &mut Config, apps_base_url: &str) {
config
.features
.enable(Feature::Apps)
Expand All @@ -112,22 +112,26 @@ fn configure_apps_without_tool_search(config: &mut Config, apps_base_url: &str)
config.model_catalog = Some(model_catalog);
}

fn configure_apps(config: &mut Config, apps_base_url: &str) {
configure_apps_without_tool_search(config, apps_base_url);
fn configure_apps_without_tool_search(config: &mut Config, apps_base_url: &str) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this method make sense?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it does while we still keep the Feature wiring.

configure_search_capable_apps(config, apps_base_url);
config
.features
.enable(Feature::ToolSearch)
.disable(Feature::ToolSearch)
.expect("test config should allow feature update");
}

fn configure_apps(config: &mut Config, apps_base_url: &str) {
configure_search_capable_apps(config, apps_base_url);
}

fn configured_builder(apps_base_url: String) -> TestCodexBuilder {
test_codex()
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_config(move |config| configure_apps(config, apps_base_url.as_str()))
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn search_tool_flag_adds_tool_search() -> Result<()> {
async fn search_tool_enabled_by_default_adds_tool_search() -> Result<()> {
skip_if_no_network!(Ok(()));

let server = start_mock_server().await;
Expand Down Expand Up @@ -185,7 +189,7 @@ async fn search_tool_flag_adds_tool_search() -> Result<()> {
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn tool_search_disabled_by_default_exposes_apps_tools_directly() -> Result<()> {
async fn tool_search_disabled_exposes_apps_tools_directly() -> Result<()> {
skip_if_no_network!(Ok(()));

let server = start_mock_server().await;
Expand Down
4 changes: 2 additions & 2 deletions codex-rs/features/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,8 @@ pub const FEATURES: &[FeatureSpec] = &[
FeatureSpec {
id: Feature::ToolSearch,
key: "tool_search",
stage: Stage::UnderDevelopment,
default_enabled: false,
stage: Stage::Stable,
default_enabled: true,
},
FeatureSpec {
id: Feature::UnavailableDummyTools,
Expand Down
6 changes: 3 additions & 3 deletions codex-rs/features/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ fn tool_suggest_is_stable_and_enabled_by_default() {
}

#[test]
fn tool_search_is_under_development_and_disabled_by_default() {
assert_eq!(Feature::ToolSearch.stage(), Stage::UnderDevelopment);
assert_eq!(Feature::ToolSearch.default_enabled(), false);
fn tool_search_is_stable_and_enabled_by_default() {
assert_eq!(Feature::ToolSearch.stage(), Stage::Stable);
assert_eq!(Feature::ToolSearch.default_enabled(), true);
}

#[test]
Expand Down
8 changes: 4 additions & 4 deletions codex-rs/tools/src/tool_registry_plan_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ fn search_tool_description_lists_each_mcp_source_once() {
}

#[test]
fn search_tool_requires_model_capability_and_feature_flag() {
fn search_tool_requires_model_capability_and_enabled_feature() {
let model_info = search_capable_model_info();
let deferred_mcp_tools = Some(vec![deferred_mcp_tool(
"_create_event",
Expand Down Expand Up @@ -1367,10 +1367,12 @@ fn search_tool_requires_model_capability_and_feature_flag() {
);
assert_lacks_tool_name(&tools, TOOL_SEARCH_TOOL_NAME);

let mut features_without_tool_search = Features::with_defaults();
features_without_tool_search.disable(Feature::ToolSearch);
let tools_config = ToolsConfig::new(&ToolsConfigParams {
model_info: &model_info,
available_models: &available_models,
features: &features,
features: &features_without_tool_search,
image_generation_tool_auth_allowed: true,
web_search_mode: Some(WebSearchMode::Cached),
session_source: SessionSource::Cli,
Expand All @@ -1385,8 +1387,6 @@ fn search_tool_requires_model_capability_and_feature_flag() {
);
assert_lacks_tool_name(&tools, TOOL_SEARCH_TOOL_NAME);

let mut features = Features::with_defaults();
features.enable(Feature::ToolSearch);
let tools_config = ToolsConfig::new(&ToolsConfigParams {
model_info: &model_info,
available_models: &available_models,
Expand Down
Loading