Skip to content

Conversation

@jamubc
Copy link
Owner

@jamubc jamubc commented Jul 17, 2025

Description

Brief description of changes

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • I have tested these changes locally
  • My code follows the project's style
  • I have updated the documentation if needed
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @jamubc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request delivers a comprehensive overhaul of the Gemini-Claude integration, focusing on reliability, efficiency, and user experience. It addresses long-standing issues with file reference handling and unnecessary file reading, introduces a groundbreaking one-time hook configuration to streamline edit application, and implements a sophisticated MCP-compliant batching system for managing large codebases. These changes collectively enhance the overall workflow, making AI-driven code modifications more seamless and robust.

Highlights

  • Enhanced Gemini-Claude Workflow: Critical fixes ensure Gemini accurately processes file references (e.g., @ts/utils/ instead of hardcoded patterns) and Claude directly applies edits without redundant file reading, streamlining the 'Gemini Reads, Claude Edits' flow.
  • One-Time Hook Configuration: A new /mcp__gemini-cli__configure-hooks slash command allows a permanent, one-time setup to eliminate 'File has not been read yet' errors. This enables Claude to directly implement Gemini's edits while preserving diff view and approval processes, with hooks persisting across sessions.
  • MCP-Compliant Batching for Large Inputs: Implemented a new, robust batching system that respects user-specified file references, handles large codebases, and includes MCP progress notifications and cursor-based continuation to efficiently manage token limits (reduced from 1M to 25k threshold with 20k batch sizes).
  • Intelligent Parameter Processing & Auto-Enforcement: The system now automatically detects edit intent in prompts and large input sizes, enabling changeMode and appropriate batching strategies. This ensures optimal interaction, prevents common errors, and includes validation for parameter combinations.
  • Improved Robustness and Performance: Includes a fallback mechanism for Gemini responses that are suspiciously large (likely API bugs) by retrying with a different model (gemini-2.5-flash). Performance is also enhanced through realistic token limits and a cleaner architecture.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant feature to streamline the "Gemini Reads, Claude Edits" workflow. My feedback focuses on enhancing robustness, maintainability, and cross-platform compatibility by addressing potential issues with external dependencies in scripts and a bug in the batch continuation logic.

}

// Process the batch
const result = await processMCPBatch(batchToProcess, "gemini-2.5-pro", false, true);

Choose a reason for hiding this comment

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

high

The call to processMCPBatch inside continueMCPBatch hardcodes several key parameters ("gemini-2.5-pro", false, true). This will cause subsequent batches to ignore the original parameters if a user started the batch operation with a different model or with sandbox=true. Store the original parameters in MCPBatchState and reuse them during continuation.

Comment on lines +1625 to +1641
command: `#!/bin/bash
# Auto-approve edits from Gemini workflow to prevent 'read first' failures
if [ -n "\\$STDIN" ]; then
session_id=$(echo "\\$STDIN" | jq -r '.session_id // empty')
transcript_path=$(echo "\\$STDIN" | jq -r '.transcript_path // empty')
tool_name=$(echo "\\$STDIN" | jq -r '.tool_name // empty')
if [ -n "\\$transcript_path" ] && [ -f "\\$transcript_path" ]; then
# Check last 30 lines for recent Gemini MCP activity
if tail -30 "\\$transcript_path" | grep -q 'mcp__gemini-cli__ask-gemini\\|mcp__gemini-cli__sandbox-test'; then
echo '{"decision": "approve", "reason": "Auto-approved: Gemini-guided edit workflow detected - bypassing read-first requirement"}'
exit 0
fi
fi
fi
# If no Gemini context found, allow normal permission flow
exit 0`

Choose a reason for hiding this comment

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

high

The embedded bash script for the configure-hooks command has a hard dependency on jq, which may not be installed on a user's system. This dependency should be documented or removed by performing the JSON parsing within this Node.js script. The script's reliance on #!/bin/bash, tail, and grep also limits its portability for Windows users.

},
"scripts": {
"build": "tsc",
"rebuild": "rm -rf dist && npm run build",

Choose a reason for hiding this comment

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

medium

The rebuild script uses rm -rf, which is not cross-platform and may fail on Windows environments. Consider using a cross-platform package like rimraf to ensure the script works for all developers.

 "rebuild": "rimraf dist && npm run build", 
* Generate unique batch ID
*/
function generateBatchId(): string {
return Date.now().toString(36) + Math.random().toString(36).substr(2);

Choose a reason for hiding this comment

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

medium

The substr method is considered a legacy feature in JavaScript and is not recommended. It's better to use substring or slice instead.

Suggested change
return Date.now().toString(36) + Math.random().toString(36).substr(2);
return Date.now().toString(36) + Math.random().toString(36).slice(2);
@jamubc jamubc closed this Jul 17, 2025
@jamubc jamubc deleted the hooked branch July 17, 2025 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants