fix: conditionally declare tools when OpenClaw is configured (fixes #12)#40
Open
juliosuas wants to merge 1 commit intoIntent-Lab:mainfrom
Open
fix: conditionally declare tools when OpenClaw is configured (fixes #12)#40juliosuas wants to merge 1 commit intoIntent-Lab:mainfrom
juliosuas wants to merge 1 commit intoIntent-Lab:mainfrom
Conversation
When OpenClaw is not configured, Gemini still received tool declarations in the setup message. This caused it to attempt tool calls (like web search) that had no backend to handle them, getting permanently stuck in "executing" state. Changes: - Only include tools array in Gemini setup when isOpenClawConfigured - Use a no-tools system instruction when OpenClaw is absent, so Gemini tells the user to enable OpenClaw instead of attempting tool calls - Add fast-fail in ToolCallRouter for unconfigured OpenClaw (defense in depth — returns immediate error instead of hanging) - Applied to both iOS (Swift) and Android (Kotlin) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Problem
When OpenClaw is not configured, Gemini still receives tool declarations (
execute) in the setup message. This causes Gemini to attempt tool calls (like web search) that have no backend to handle them — the app gets permanently stuck showing "Running: execute..." with no way to recover.This is the root cause of Issue #12 ("Gemini stuck once it tries to search the web").
Root Cause
The
sendSetupMessage()function unconditionally included thetoolsarray, regardless of whether OpenClaw was configured. When Gemini calledexecute, theToolCallRoutersent the request to a non-existent gateway, which either timed out after 120s or failed silently.Fix (3 layers of defense)
1. Conditional tool declaration
sendSetupMessage()now only includes thetoolsarray whenGeminiConfig.isOpenClawConfiguredis true.2. No-tools system instruction
When OpenClaw is not configured, uses a different system prompt that tells Gemini it has no tools and should inform the user to set up OpenClaw in Settings.
3. Fast-fail in ToolCallRouter
As defense-in-depth,
ToolCallRouter.handleToolCall()now checksisOpenClawConfiguredbefore routing. If unconfigured, returns an immediate error response to Gemini instead of hanging.Files Changed
GeminiLiveService.swift/.kt— conditional tool declaration in setupGeminiConfig.swift/.kt— addednoToolsSystemInstructionToolCallRouter.swift/.kt— fast-fail guardBehaviour
Test plan
🤖 Generated with Claude Code