fix(codex): route hosted web_search requests off the Responses Lite lane#35
Conversation
The Responses Lite lane used for gpt-5.6-{sol,terra,luna} moves every tool
into an AdditionalTools developer prefix and sends top-level tools: null.
Upstream only supports function/custom tools on that lane, so a hosted
web_search tool is never registered:
- a forced {type: tool, name: web_search} tool_choice translates to a
top-level web_search tool_choice that references no registered tool,
which upstream rejects with 502
"Tool choice 'web_search_preview' not found in 'tools' parameter" (raine#26)
- unforced searches never engage real web search, so Claude Code's
WebSearch reports zero results
Registering the web_search tool top-level on the lite lane is not an
option — upstream rejects it: "X-OpenAI-Internal-Codex-Responses-Lite
only supports function tools, custom tools, and client-executed tool
search."
Fix: requests carrying a hosted web_search tool use the full Responses
API instead of the lite lane, where web_search registers top-level and
searches execute (verified live: real results through gpt-5.6-sol).
Also downgrade a web_search tool_choice to auto whenever no web_search
tool ended up registered, so no request shape can reproduce the 502.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
One follow-up observation from live testing (kept out of this PR to stay focused on the 502): with the lane routing in place, search result relevance through the Codex backend is noticeably better with |
|
Second live finding, same caveat (not in this PR): the Codex backend appears to zero out results when |
|
Thank you |
|
I'm seeing it also, have to look into it a bit |
|
Should be fixed in latest |
Fixes #26.
Problem
On the Responses Lite lane (
gpt-5.6-sol/-terra/-luna), every tool is moved into theAdditionalToolsdeveloper prefix and the top-leveltoolsparam is sent asnull. A hostedweb_search_20250305tool therefore never registers upstream:tool_choice: {type: "tool", name: "web_search"}, which translates to a top-levelweb_searchtool_choice referencing no registered tool. Upstream rejects with 502Tool choice 'web_search_preview' not found in 'tools' parameter(the exact error in Tool choice 'web_search_preview' not found in 'tools' parameter. #26).Registering
web_searchtop-level on the lite lane is not an option — upstream rejects the request withX-OpenAI-Internal-Codex-Responses-Lite only supports function tools, custom tools, and client-executed tool search.(verified empirically).Fix
has_hosted_web_search(): requests carrying a hostedweb_search_20250305tool skip the lite lane and use the full Responses API, whereweb_searchregisters top-level and executes for real.translate_request: if aweb_searchtool_choice would be emitted without a registeredweb_searchtool (e.g. anything still on the lite lane), it downgrades toauto— no request shape can reproduce the 502.Testing
ANTHROPIC_MODEL=gpt-5.6-sol: forced and unforced WebSearch return real results in Claude Code, e.g.Web Search("raine claude-code-proxy github")→ the repo/issues/releases URLs. WebFetch unaffected (client-side) and confirmed working alongside.🤖 Opened by Barsik — generated with Claude Code