Skip to content

Comments

fix: remove duplicate WEB_SEARCH_FALLBACK_MODEL downgrade — fixes OpenClaw compatibility#2007

Open
smilovanov-5am wants to merge 1 commit intolbjlaq:mainfrom
smilovanov-5am:fix/remove-web-search-fallback-duplicate
Open

fix: remove duplicate WEB_SEARCH_FALLBACK_MODEL downgrade — fixes OpenClaw compatibility#2007
smilovanov-5am wants to merge 1 commit intolbjlaq:mainfrom
smilovanov-5am:fix/remove-web-search-fallback-duplicate

Conversation

@smilovanov-5am
Copy link

@smilovanov-5am smilovanov-5am commented Feb 16, 2026

Summary

  • Removed the unconditional WEB_SEARCH_FALLBACK_MODEL downgrade in request.rs (Claude protocol mapper) that duplicated the same logic already present in common_utils::resolve_request_config().
  • Fixes OpenClaw compatibility: requests from OpenClaw were always detected as having web_search_tool, causing every model to be unconditionally downgraded to gemini-2.5-flash regardless of actual capabilities.

Problem

Two places performed web-search model downgrade:

  1. request.rs L423-433 (removed) — unconditionally replaced any model with gemini-2.5-flash when has_web_search_tool == true
  2. common_utils.rs resolve_request_config() — correctly checks an allowlist before downgrading, preserving high-quality models that natively support Google Search

The first check ran before resolve_request_config(), so by the time the allowlist check executed, the model was already gemini-2.5-flash — making the allowlist logic dead code.

Impact

Models like claude-sonnet-4-5-thinking (maps to itself, in allowlist via contains("claude-sonnet")), claude-opus-4-6-thinking (maps to itself, in allowlist via contains("claude-opus")), gemini-3-pro, etc. were unnecessarily downgraded to gemini-2.5-flash for 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-flash through the Claude protocol.

Fix

Removed the first unconditional downgrade. Now mapped_model always goes through normal mapping via map_claude_model_to_gemini(), and resolve_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

…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.
@smilovanov-5am smilovanov-5am changed the title fix: remove duplicate WEB_SEARCH_FALLBACK_MODEL downgrade in Claude request mapper fix: remove duplicate WEB_SEARCH_FALLBACK_MODEL downgrade — fixes OpenClaw compatibility Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant