8000 feat: enhance configuration with trust support and increased limits by FojleRabbiRabib · Pull Request #8 · eLyiN/gemini-bridge · GitHub
[go: up one dir, main page]

Skip to content

feat: enhance configuration with trust support and increased limits - #8

Closed
FojleRabbiRabib wants to merge 1 commit into
eLyiN:masterfrom
FojleRabbiRabib:master
Closed

FojleRabbiRabib wants to merge 1 commit into
eLyiN:masterfrom
FojleRabbiRabib:master

Conversation

@FojleRabbiRabib
Copy link
Copy Markdown
Contributor

Summary

Major enhancements to improve configurability and resolve user-reported issues in automated environments.

New Features

Trust Workspace Support

  • Automatic --skip-trust flag for headless/automated environments
  • New GEMINI_BRIDGE_TRUST_WORKSPACE environment variable (default: true)
  • Resolves Gemini CLI trust directory errors in automated environments
  • Can be disabled for environments requiring manual trust approval

Enhanced Configurability

  • New GEMINI_BRIDGE_DEFAULT_TIMEOUT environment variable (default: 120 seconds)
  • New GEMINI_BRIDGE_DEFAULT_MODEL environment variable (default: flash)
  • All major options now configurable via environment variables

Performance Improvements

Increased File Limits

  • 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 file attachment limit warnings significantly

Better Timeout Support

  • Default timeout increased: 60 seconds → 120 seconds
  • Better support for large file analysis and complex queries
  • Per-call timeout override capability preserved

Testing

  • Added 11 new tests for trust functionality and configuration
  • Updated 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

Environment Variables Added

  • GEMINI_BRIDGE_TRUST_WORKSPACE - Auto-trust workspaces (default: true)
  • GEMINI_BRIDGE_DEFAULT_TIMEOUT - Set default timeout (default: 120)
  • GEMINI_BRIDGE_DEFAULT_MODEL - Set default model (default: flash)

Backward Compatibility

  • All existing functionality preserved
  • Existing environment variables continue to work
  • Per-call parameters override environment defaults
  • No breaking changes to MCP tool interfaces

Issues Resolved

  • Trust workspace errors: Automatic workspace trust prevents FatalUntrustedWorkspaceError in CI/CD
  • File attachment limits: Reduced Inline file limit reached warnings with 3x improvement
  • Large file handling: Better support for analyzing large files with increased timeout and size limits

… 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.
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-trust to the gemini invocation 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 thread src/mcp_server.py
Comment on lines +301 to +303
# Add trust flag for automated environments if enabled
if TRUST_WORKSPACE.lower() == "true":
cmd.append("--skip-trust")
Comment thread tests/test_mcp_server.py
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
Comment thread src/mcp_server.py
cmd = ["gemini", "-m", selected_model]

# Add trust flag for automated environments if enabled
if TRUST_WORKSPACE.lower() == "true":
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.

2 participants

0