Skip to content

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io

fix(codex): disable hosted web_search for Gemini models on native Responses

Jasonf1e7762dc020
diff --git a/src-tauri/src/codex_config.rs b/src-tauri/src/codex_config.rs
index 2eda46635..d215ab4a4 100644
--- a/src-tauri/src/codex_config.rs
+++ b/src-tauri/src/codex_config.rs
@@ -85,8 +85,15 @@ const CODEX_WEB_SEARCH_REJECT_HOSTS: &[&str] = &[
/// against the model id's last `/`-segment so aggregator ids like
/// `MiniMaxAI/MiniMax-M3` are caught. Exact brand names (not a fuzzy heuristic),
/// so a supporting gateway is never wrongly matched.
+///
+/// `gemini`: Google ships no native `/responses` endpoint, so a Gemini model on a
+/// native Responses provider is always a relay translating to Gemini, and those
+/// relays reject Codex's hosted `web_search` ("only client-executed
+/// functionDeclarations are supported" #10230, "Gemini native tool google_search
+/// requires a native upstream" #10173). Gemini over Chat Completions (the
+/// official preset) is ProxyChat and never consults this list.
const CODEX_WEB_SEARCH_REJECT_MODEL_PREFIXES: &[&str] =
- &["mimo", "longcat", "minimax", "qwen3-coder", "glm"];
+ &["mimo", "longcat", "minimax", "qwen3-coder", "glm", "gemini"];
/// The URL without its `scheme://`, or the whole input when it has none. Only a
/// real scheme (a letter, then letters, digits, `+`, `-`, `.`) counts, so a
diff --git a/src-tauri/src/codex_config/tests.rs b/src-tauri/src/codex_config/tests.rs
index 552976e8d..f13effcc4 100644
--- a/src-tauri/src/codex_config/tests.rs
+++ b/src-tauri/src/codex_config/tests.rs
@@ -1850,6 +1850,12 @@ fn web_search_blacklist_disables_only_known_reject_gateways() {
"qwen/qwen3-coder-plus",
"https://some-aggregator.example/v1",
),
+ // Gemini behind a native Responses relay (#10230, #10173).
+ ("gemini-4-neon", "https://some-relay.example/v1"),
+ (
+ "google/Gemini-4-Carbon",
+ "https://some-aggregator.example/v1",
+ ),
] {
assert!(
codex_native_gateway_rejects_web_search(&cfg(model, host)),
diff --git a/src-tauri/src/proxy/forwarder/tests.rs b/src-tauri/src/proxy/forwarder/tests.rs
index fc60665ee..26171a84c 100644
--- a/src-tauri/src/proxy/forwarder/tests.rs
+++ b/src-tauri/src/proxy/forwarder/tests.rs
@@ -3676,7 +3676,7 @@ mod codex_stack {
}
// This model and the localhost gateway are not on the rejection lists.
- let mut request = body("gemini-4-hydrogen", tools.clone());
+ let mut request = body("deepseek-v4-pro", tools.clone());
request["tool_choice"] = json!({ "type": "web_search" });
let seen = send(&forwarder(stack), &upstream, target, "/responses", request).await;