Repository navigation
feat: enhance configuration with trust support and increased limits - #8
Closed
FojleRabbiRabib wants to merge 1 commit into
Closed
FojleRabbiRabib wants to merge 1 commit into
FojleRabbiRabib wants to merge 1 commit into
Conversation
… improved defaults Major enhancements to address user-reported issues and improve configurability. - Add automatic --skip-trust flag for headless/automated environments - New GEMINI_BRIDGE_TRUST_WORKSPACE environment variable (default: true) - Resolves "Gemini CLI is not running in a trusted directory" errors - Can be disabled for environments requiring manual trust approval - Increase default timeout: 60 seconds → 120 seconds - Better support for large file analysis and complex queries - New GEMINI_BRIDGE_DEFAULT_TIMEOUT environment variable - MAX_INLINE_FILE_COUNT: 10 → 30 files (3x improvement) - MAX_INLINE_TOTAL_BYTES: 512KB → 1MB (2x improvement) - MAX_INLINE_FILE_BYTES: 256KB → 512KB (2x improvement) - Reduces "Inline file limit reached" warnings significantly - New GEMINI_BRIDGE_DEFAULT_MODEL environment variable (default: flash) - All major options now configurable via environment variables - Better support for different usage patterns and requirements - Add 11 new tests for trust functionality and configuration - Update 4 existing tests for new command format and defaults - All 45 tests passing with comprehensive coverage - New tests cover: trust workspace, file limits, custom defaults, env var priority - GEMINI_BRIDGE_DEFAULT_TIMEOUT: Set default timeout (default: 120) - GEMINI_BRIDGE_DEFAULT_MODEL: Set default model (default: flash) - GEMINI_BRIDGE_TRUST_WORKSPACE: Auto-trust workspaces (default: true) - All existing functionality preserved - Existing environment variables continue to work - Per-call parameters override environment defaults - No breaking changes to MCP tool interfaces Resolves issues with file attachment limits and trust errors in automated environments while maintaining full backward compatibility.
There was a problem hiding this comment.
Pull request overview
Adds environment-driven configuration to the MCP bridge: a new "trust workspace" option that appends a --skip-trust CLI flag, configurable default model and default timeout, and raises the inline file-attachment limits (count 10→30, total 512KB→1MB, per-file 256KB→512KB). Tests are updated to reflect the new command shape and defaults, and new tests cover the added env vars.
Changes:
- Introduce
GEMINI_BRIDGE_TRUST_WORKSPACE,GEMINI_BRIDGE_DEFAULT_TIMEOUT,GEMINI_BRIDGE_DEFAULT_MODEL, and append--skip-trustto thegeminiinvocation when trust is enabled. - Bump default timeout (60→120s) and inline file/byte limits.
- Update existing tests for the new command/defaults and add tests for trust, file limits, and env-var priority/customisation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/mcp_server.py | Adds env-driven config block, threads DEFAULT_MODEL/DEFAULT_TIMEOUT through normalisers, and conditionally appends --skip-trust to both gemini command builders. |
| tests/test_mcp_server.py | Renames env-clearing fixture, updates existing command-equality assertions to include --skip-trust, and adds tests for trust toggle, raised limits, custom default model/timeout, and env-var priority (using importlib.reload). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+301
to
+303
| # Add trust flag for automated environments if enabled | ||
| if TRUST_WORKSPACE.lower() == "true": | ||
| cmd.append("--skip-trust") |
Comment on lines
+463
to
+483
| def test_increased_default_file_limits(monkeypatch): | ||
| """Test that default file limits have been increased.""" | ||
| # Test new defaults | ||
| assert mcp_server.MAX_INLINE_FILE_COUNT == 30 # Increased from 10 | ||
| assert mcp_server.MAX_INLINE_TOTAL_BYTES == 1024 * 1024 # 1MB instead of 512KB | ||
| assert mcp_server.MAX_INLINE_FILE_BYTES == 512 * 1024 # 512KB instead of 256KB | ||
|
|
||
|
|
||
| def test_file_limits_can_be_customized(monkeypatch): | ||
| """Test that file limits can be customized via environment variables.""" | ||
| monkeypatch.setenv("GEMINI_BRIDGE_MAX_INLINE_FILE_COUNT", "50") | ||
| monkeypatch.setenv("GEMINI_BRIDGE_MAX_INLINE_TOTAL_BYTES", str(2 * 1024 * 1024)) | ||
| monkeypatch.setenv("GEMINI_BRIDGE_MAX_INLINE_FILE_BYTES", str(1024 * 1024)) | ||
|
|
||
| # Need to reload the module to pick up new environment variables | ||
| import importlib | ||
| importlib.reload(mcp_server) | ||
|
|
||
| assert mcp_server.MAX_INLINE_FILE_COUNT == 50 | ||
| assert mcp_server.MAX_INLINE_TOTAL_BYTES == 2 * 1024 * 1024 | ||
| assert mcp_server.MAX_INLINE_FILE_BYTES == 1024 * 1024 |
| cmd = ["gemini", "-m", selected_model] | ||
|
|
||
| # Add trust flag for automated environments if enabled | ||
| if TRUST_WORKSPACE.lower() == "true": |
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
Major enhancements to improve configurability and resolve user-reported issues in automated environments.
New Features
Trust Workspace Support
Enhanced Configurability
Performance Improvements
Increased File Limits
Better Timeout Support
Testing
Environment Variables Added
Backward Compatibility
Issues Resolved