fix: add timeout mechanism and improve error handling#8
Open
hweeken wants to merge 1 commit intoGuDaStudio:mainfrom
Open
fix: add timeout mechanism and improve error handling#8hweeken wants to merge 1 commit intoGuDaStudio:mainfrom
hweeken wants to merge 1 commit intoGuDaStudio:mainfrom
Conversation
## Changes ### 1. Global Timeout Mechanism - Added `timeout` parameter (default 300 seconds) to prevent infinite blocking - `GeminiTimeoutError` exception for clear error reporting - Proper process cleanup on timeout ### 2. Pre-flight Auth Check - `check_gemini_auth()` function to detect auth issues early - Clear error message guiding users to run `gemini auth login` ### 3. Improved Resource Management - Bounded queue (maxsize=10000) to prevent memory issues - Daemon threads for proper cleanup on exit - Better process termination handling ### 4. Code Quality - Removed unused imports (uuid, List, Literal, BeforeValidator, os) - Fixed cmd list mutation bug (now uses copy()) - Limited error message accumulation (max 2000 chars) - Bumped version to 0.1.1 Fixes GuDaStudio#7 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <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.
Summary
This PR addresses the issues reported in #7, implementing critical fixes to prevent MCP calls from blocking indefinitely and improving error handling.
Changes
1. 🔴 Global Timeout Mechanism (Critical Fix)
timeoutparameter togemini()tool (default: 300 seconds)GeminiTimeoutErrorexception for clear error reportingrun_shell_command()Before: MCP call could block forever if Gemini CLI got stuck
After: Call fails gracefully with clear error message after timeout
2. 🔴 Pre-flight Auth Check
check_gemini_auth()function to detect auth issues earlygemini auth login3. 🟡 Improved Resource Management
copy())4. 🟢 Code Quality
uuid,List,Literal,BeforeValidator,os)0.1.1Testing
The changes have been reviewed by two independent AI code reviewers (Claude Opus 4.5 and OpenAI Codex) who identified the original issues.
Related Issues
Fixes #7
🤖 Generated with Claude Code