fix: prevent googleSearch + functionDeclarations mixed tools regression#2245
Open
thebtf wants to merge 7 commits intolbjlaq:mainfrom
Open
fix: prevent googleSearch + functionDeclarations mixed tools regression#2245thebtf wants to merge 7 commits intolbjlaq:mainfrom
thebtf wants to merge 7 commits intolbjlaq:mainfrom
Conversation
* feat: add CLI config export for web/Docker mode In web mode (Docker), the One-click CLI Sync section now generates drop-in config files for all 5 CLI tools (Claude Code, Codex, Gemini CLI, OpenCode, Droid) and writes them to ~/.antigravity_tools/one-click-sync/ which is volume-mounted to the host. Backend: - Extract generate_file_content() helper from sync_config() in cli_sync.rs - Add export_config() and get_export_status() for Claude/Codex/Gemini - Add export functions to opencode_sync.rs and droid_sync.rs - Add 6 HTTP routes and handlers in server.rs - Register 6 new Tauri commands in lib.rs Frontend: - Detect web mode via isTauri() and adapt CliSyncCard UI - Show "Export Mode" badge, "Exported/Not Exported" status - Show export directory instead of base URL - "Export" button replaces "Sync", hide Restore/View/Clear in web mode - Non-destructive confirm dialog for export operations * fix: address code review findings — safer JSON handling, atomic writes - Replace unwrap() chains on nested JSON with safe if-let patterns - Use atomic temp+rename for export_config() writes - Replace unwrap() on serialization with map_err in opencode/droid export - Add remove_file before rename for Windows compatibility - Check all files exported (not just any) in get_export_status() * feat: Claude Code 3-tier model support (opus/sonnet/haiku) + export UX - Add ClaudeModelTiers struct for opus/sonnet/haiku model selection - Set all Claude Code env vars: ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_OPUS/SONNET/HAIKU_MODEL, CLAUDE_CODE_SUBAGENT_MODEL - Clean stale tier vars on fallback to single-model mode - Replace single model selector with 3 GroupedSelect for Claude - Add export usage instructions banner in web mode - Fix: Windows-only remove_file before rename with error propagation - Fix: consistent field visibility in CliSyncRequest - Bump version to 4.1.27 * feat: persist CLI sync model selections in localStorage Model selections (including Claude 3-tier opus/sonnet/haiku) now survive page reloads via localStorage persistence. --------- Co-authored-by: Kirill Turanskiy <kt@novamedia.ru>
…mismatch export_config skips config.json when settings.json exists, but get_export_status counted all 3 files as expected. Now mirrors the same skip logic so exported count matches expected count.
In Docker/web mode, CLI tools run on the host machine, not inside the container. The exported proxy URL now uses window.location.hostname (the address the user accessed the UI from) instead of 127.0.0.1.
…ression) v4.1.28 introduced a `supports_mixed_tools` allowlist that enabled mixing googleSearch with functionDeclarations for gemini-2.0/2.5/3.x models. This causes 400 errors because the Gemini generateContent API does NOT support mixed tool types — this is a model-level restriction confirmed by Google documentation and staff (google/adk-python#969). Only the Live API (WebSocket) supports combining built-in tools with custom function declarations. Changes: - common_utils: remove mapped_model parameter and supports_mixed_tools allowlist from inject_google_search_tool; unconditionally skip injection when functionDeclarations are present - claude/request: rewrite build_tools to make functionDeclarations and googleSearch mutually exclusive (functionDeclarations take priority) - Update all call sites (gemini/wrapper, openai/request, claude/request) - Fix tests to assert mixed tools are never produced
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
v4.1.28 introduced a
supports_mixed_toolsmodel-based allowlist that re-enabled mixinggoogleSearchwithfunctionDeclarationsfor gemini-2.0/2.5/3.x models. This causes 400 errors because the GeminigenerateContentAPI does not support mixed tool types — this is a model-level restriction, not an SDK limitation.Evidence
Error reproduced
{ "error": { "code": 400, "message": "Built-in tools ({google_search}) and Custom tools (Function Calling) cannot be combined in a single request for models/gemini-2.5-flash-preview-04-17" } }Changes
common_utils.rsmapped_modelparam andsupports_mixed_toolsallowlist frominject_google_search_tool; unconditionally skip injection whenfunctionDeclarationspresentclaude/request.rsbuild_toolsto makefunctionDeclarationsandgoogleSearchmutually exclusive (functionDeclarationstake priority)gemini/wrapper.rsopenai/request.rsRegression history
if has_functions { return }— never mixedsupports_mixed_toolsallowlist — mixed tools on 2.0/2.5/3.x → 400Test plan
inject_google_search_toolskips injection whenfunctionDeclarationsexistbuild_tools(Claude mapper) produces onlyfunctionDeclarationswhen both tools + web_search present