Repository navigation
Conversation
…date repair logic
Summary of ChangesHello, 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 introduces critical reliability enhancements to the core agent session and scheduler. By implementing automatic tool name repair and intelligent response continuation, the system becomes significantly more resilient to common LLM-related issues like hallucinated tool names and token truncation. Additionally, minor infrastructure improvements were made to build and linting processes to improve stability. Highlights
Using Gemini Code AssistThe 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 by creating a comment using either
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 Limitations & Feedback Gemini Code Assist 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request implements auto-continuation for truncated agent responses (MAX_TOKENS) and introduces a tool name repair mechanism using fuzzy matching and normalization to handle hallucinated tool calls. Review feedback highlights a bug in the continuation logic that duplicates conversation history, a regression in workspace detection robustness within the build script, and a reduction in script portability caused by switching from curl to wget in the linting setup.
| ); | ||
| this._emit([continuationMessage]); | ||
|
|
||
| currentParts = [...currentParts, { text: continuationPrompt }]; |
There was a problem hiding this comment.
The continuation logic incorrectly appends the continuation prompt to the previous turn's input (currentParts). In LegacyAgentProtocol, currentParts is intended to be the input for the next model turn. Appending to it will cause the previous turn's input to be duplicated in the conversation history. It should be replaced with only the continuation prompt to ensure legacy behavior remains consistent with modern counterparts.
| currentParts = [...currentParts, { text: continuationPrompt }]; | |
| currentParts = [{ text: continuationPrompt }]; |
References
- Legacy prompts should be kept consistent with their modern counterparts to ensure uniform behavior.
| const parallelWorkspaces = getWorkspaces().filter( | ||
| (name) => name !== '@google/gemini-cli-core', | ||
| ); |
There was a problem hiding this comment.
Replacing npm query .workspace with a manual getWorkspaces function is a regression in robustness. The manual implementation is fragile, assumes a specific directory structure (packages/*), and ignores the workspaces field in the root package.json. Reverting to the original npm query approach is more robust and maintainable. The getWorkspaces helper function should also be removed.
const workspaceInfo = JSON.parse(
execSync('npm query .workspace --json', { cwd: root, encoding: 'utf-8' }),
);
const parallelWorkspaces = workspaceInfo
.map((w) => w.name)
.filter((name) => name !== '@google/gemini-cli-core');| : ` | ||
| mkdir -p "${TEMP_DIR}/actionlint" | ||
| curl -sSLo "${TEMP_DIR}/.actionlint.tgz" "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_${platformArch.actionlint}.tar.gz" | ||
| wget -O "${TEMP_DIR}/.actionlint.tgz" "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_${platformArch.actionlint}.tar.gz" |
There was a problem hiding this comment.
Changing curl to wget reduces the portability of the script. curl is more commonly available in minimal CI environments and containers. Unless there is a specific reason for this change, it is recommended to stick with curl.
| wget -O "${TEMP_DIR}/.actionlint.tgz" "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_${platformArch.actionlint}.tar.gz" | |
| curl -sSLo "${TEMP_DIR}/.actionlint.tgz" "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_${platformArch.actionlint}.tar.gz" |
| : ` | ||
| mkdir -p "${TEMP_DIR}/shellcheck" | ||
| curl -sSLo "${TEMP_DIR}/.shellcheck.txz" "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.${platformArch.shellcheck}.tar.xz" | ||
| wget -O "${TEMP_DIR}/.shellcheck.txz" "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.${platformArch.shellcheck}.tar.xz" |
There was a problem hiding this comment.
Changing curl to wget reduces the portability of the script. curl is more commonly available in minimal CI environments and containers. Unless there is a specific reason for this change, it is recommended to stick with curl.
| wget -O "${TEMP_DIR}/.shellcheck.txz" "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.${platformArch.shellcheck}.tar.xz" | |
| curl -sSLo "${TEMP_DIR}/.shellcheck.txz" "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.${platformArch.shellcheck}.tar.xz" |
|
I've addressed the review feedback:
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces auto-continuation for truncated LLM responses and a tool name hallucination repair mechanism. When a response is cut off due to token limits (MAX_TOKENS), the agent now automatically prompts for the remainder of the content, up to a limit of three continuations. Additionally, the scheduler now attempts to correct minor errors in tool names by normalizing kebab-case to snake_case and performing fuzzy matching using Levenshtein distance. Infrastructure improvements include refactored workspace detection in build scripts and a wget fallback for dependency installation in linting scripts. I have no feedback to provide as there were no review comments to evaluate.
This PR implements two key reliability features in the core package:
Includes new utility
fuzzy-matcher.tsand comprehensive tests for both features.