Lightweight coding agent that runs in your terminal
Rust
Use canonical indexed web access field (#31289)
Winston Howes07d631875e38
diff --git a/codex-rs/core/src/tools/hosted_spec.rs b/codex-rs/core/src/tools/hosted_spec.rsindex 24a7905fa6..83996afcca 100644--- a/codex-rs/core/src/tools/hosted_spec.rs+++ b/codex-rs/core/src/tools/hosted_spec.rs@@ -18,7 +18,7 @@ pub fn create_image_generation_tool(output_format: &str) -> ToolSpec {}pub fn create_web_search_tool(options: WebSearchToolOptions<'_>) -> Option<ToolSpec> {- let (external_web_access, index_gated_web_access) = match options.web_search_mode {+ let (external_web_access, indexed_web_access) = match options.web_search_mode {Some(WebSearchMode::Cached) => (false, None),Some(WebSearchMode::Indexed) => (true, Some(true)),Some(WebSearchMode::Live) => (true, None),@@ -37,7 +37,7 @@ pub fn create_web_search_tool(options: WebSearchToolOptions<'_>) -> Option<ToolSSome(ToolSpec::WebSearch {external_web_access: Some(external_web_access),- index_gated_web_access,+ indexed_web_access,filters: options.web_search_config.and_then(|config| config.filters.clone().map(Into::into)),diff --git a/codex-rs/core/src/tools/hosted_spec_tests.rs b/codex-rs/core/src/tools/hosted_spec_tests.rsindex d3c48842a8..cec4b86871 100644--- a/codex-rs/core/src/tools/hosted_spec_tests.rs+++ b/codex-rs/core/src/tools/hosted_spec_tests.rs@@ -39,7 +39,7 @@ fn web_search_tool_preserves_configured_options() {}),Some(ToolSpec::WebSearch {external_web_access: Some(true),- index_gated_web_access: None,+ indexed_web_access: None,filters: Some(ResponsesApiWebSearchFilters {allowed_domains: Some(vec!["example.com".to_string()]),}),diff --git a/codex-rs/core/src/tools/spec_plan_tests.rs b/codex-rs/core/src/tools/spec_plan_tests.rsindex d95cb5ff44..d19744be46 100644--- a/codex-rs/core/src/tools/spec_plan_tests.rs+++ b/codex-rs/core/src/tools/spec_plan_tests.rs@@ -1609,7 +1609,7 @@ async fn hosted_tools_follow_provider_auth_model_and_config_gates() {live_web_search.visible_spec("web_search"),&ToolSpec::WebSearch {external_web_access: Some(true),- index_gated_web_access: None,+ indexed_web_access: None,filters: None,user_location: None,search_context_size: None,diff --git a/codex-rs/core/tests/suite/web_search.rs b/codex-rs/core/tests/suite/web_search.rsindex 5728b97a74..178789eff6 100644--- a/codex-rs/core/tests/suite/web_search.rs+++ b/codex-rs/core/tests/suite/web_search.rs@@ -276,7 +276,7 @@ location = { country = "US", city = "New York", timezone = "America/New_York" }}#[tokio::test(flavor = "multi_thread", worker_threads = 2)]-async fn indexed_web_search_mode_sets_index_gate() {+async fn indexed_web_search_mode_sets_indexed_access() {skip_if_no_network!();let server = start_mock_server().await;@@ -308,7 +308,7 @@ async fn indexed_web_search_mode_sets_index_gate() {assert_eq!((tool.get("external_web_access").and_then(Value::as_bool),- tool.get("index_gated_web_access").and_then(Value::as_bool),+ tool.get("indexed_web_access").and_then(Value::as_bool),),(Some(true), Some(true)));diff --git a/codex-rs/tools/src/tool_spec.rs b/codex-rs/tools/src/tool_spec.rsindex 146cef3b68..48ccd476b6 100644--- a/codex-rs/tools/src/tool_spec.rs+++ b/codex-rs/tools/src/tool_spec.rs@@ -30,15 +30,15 @@ pub enum ToolSpec {// TODO: Understand why we get an error on web_search although the API docs// say it's supported.// https://platform.openai.com/docs/guides/tools-web-search?api-mode=responses#:~:text=%7B%20type%3A%20%22web_search%22%20%7D%2C- // The `external_web_access` field determines whether the web search is over- // cached or live content.+ // `external_web_access` distinguishes cached from live-capable search, while+ // `indexed_web_access` restricts live fetches to indexed URLs.// https://platform.openai.com/docs/guides/tools-web-search#live-internet-access#[serde(rename = "web_search")]WebSearch {#[serde(skip_serializing_if = "Option::is_none")]external_web_access: Option<bool>,#[serde(skip_serializing_if = "Option::is_none")]- index_gated_web_access: Option<bool>,+ indexed_web_access: Option<bool>,#[serde(skip_serializing_if = "Option::is_none")]filters: Option<ResponsesApiWebSearchFilters>,#[serde(skip_serializing_if = "Option::is_none")]diff --git a/codex-rs/tools/src/tool_spec_tests.rs b/codex-rs/tools/src/tool_spec_tests.rsindex b6f599d5d5..406f92c52e 100644--- a/codex-rs/tools/src/tool_spec_tests.rs+++ b/codex-rs/tools/src/tool_spec_tests.rs@@ -67,7 +67,7 @@ fn tool_spec_name_covers_all_variants() {assert_eq!(ToolSpec::WebSearch {external_web_access: Some(true),- index_gated_web_access: None,+ indexed_web_access: None,filters: None,user_location: None,search_context_size: None,@@ -200,7 +200,7 @@ fn web_search_tool_spec_serializes_expected_wire_shape() {assert_eq!(serde_json::to_value(ToolSpec::WebSearch {external_web_access: Some(true),- index_gated_web_access: None,+ indexed_web_access: Some(true),filters: Some(ResponsesApiWebSearchFilters {allowed_domains: Some(vec!["example.com".to_string()]),}),@@ -218,6 +218,7 @@ fn web_search_tool_spec_serializes_expected_wire_shape() {json!({"type": "web_search","external_web_access": true,+ "indexed_web_access": true,"filters": {"allowed_domains": ["example.com"],},