fix: remove duplicate WEB_SEARCH_FALLBACK_MODEL downgrade — fixes OpenClaw compatibility#2007
Open
smilovanov-5am wants to merge 1 commit intolbjlaq:mainfrom
Open
Conversation
…equest mapper The unconditional model downgrade to gemini-2.5-flash in request.rs duplicated the same logic already present in common_utils::resolve_request_config(). The first (removed) check blindly replaced ANY model when web_search tools were detected, breaking the allowlist-aware downgrade in resolve_request_config() which correctly preserves high-quality models (gemini-3-pro, claude-sonnet, etc.) that natively support Google Search.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WEB_SEARCH_FALLBACK_MODELdowngrade inrequest.rs(Claude protocol mapper) that duplicated the same logic already present incommon_utils::resolve_request_config().web_search_tool, causing every model to be unconditionally downgraded togemini-2.5-flashregardless of actual capabilities.Problem
Two places performed web-search model downgrade:
request.rsL423-433 (removed) — unconditionally replaced any model withgemini-2.5-flashwhenhas_web_search_tool == truecommon_utils.rsresolve_request_config()— correctly checks an allowlist before downgrading, preserving high-quality models that natively support Google SearchThe first check ran before
resolve_request_config(), so by the time the allowlist check executed, the model was alreadygemini-2.5-flash— making the allowlist logic dead code.Impact
Models like
claude-sonnet-4-5-thinking(maps to itself, in allowlist viacontains("claude-sonnet")),claude-opus-4-6-thinking(maps to itself, in allowlist viacontains("claude-opus")),gemini-3-pro, etc. were unnecessarily downgraded togemini-2.5-flashfor web search requests, even though they natively support Google Search and are explicitly in the allowlist.This particularly affected OpenClaw users, since OpenClaw requests always include web search tool definitions, triggering the unconditional downgrade on every single request — effectively making it impossible to use any model other than
gemini-2.5-flashthrough the Claude protocol.Fix
Removed the first unconditional downgrade. Now
mapped_modelalways goes through normal mapping viamap_claude_model_to_gemini(), andresolve_request_config()handles the downgrade only when the model is not in the search-capable allowlist.Files Changed
src-tauri/src/proxy/mappers/claude/request.rs— 1 file, +7 / -12 lines