Repository navigation
fix(core): normalize tool names with underscores - #3
Conversation
This commit modifies the linting script to make actionlint and shellcheck linters no-ops when running on the Windows platform. This improves cross-platform compatibility by preventing errors on unsupported platforms.
This commit introduces a Code of Conduct to the project to foster a welcoming and inclusive community. It also updates the CONTRIBUTING.md to reference the new Code of Conduct.
My new feature
Summary of ChangesHello @aka76bm, 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 several improvements across the project, focusing on consistency, community guidelines, and build robustness. It standardizes tool name handling within the core agent executor, establishes a clear Code of Conduct for contributors, and enhances the linting script to be more adaptable across different operating systems. These changes collectively contribute to a more stable, maintainable, and inclusive development environment. 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. 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a fix to normalize tool names by replacing underscores with hyphens. However, this change appears to be incorrect as the tool definitions within the codebase use underscores, which would cause tool authorization to fail. I've provided a critical comment with a suggested fix to reverse the normalization logic. The other changes, which add a Code of Conduct and improve the linting script for Windows compatibility, look good.
| const normalizedToolName = functionCall.name.replaceAll('_', '-'); | ||
|
|
||
| // Handle standard tools | ||
| if (!allowedToolNames.has(functionCall.name as string)) { | ||
| if (!allowedToolNames.has(normalizedToolName)) { |
There was a problem hiding this comment.
The tool name normalization appears to be incorrect. The internal tools in this project (e.g., write_file, run_shell_command) are defined with underscores. This change replaces underscores with hyphens, which will cause the allowedToolNames.has() check to fail for valid tools, resulting in an "Unauthorized tool call" error.
To correctly handle tool names that might come from the model with hyphens, you should normalize towards using underscores, which is the convention in this codebase. This will also ensure that the normalizedToolName used later in the requestInfo correctly matches the tool name in the registry.
| const normalizedToolName = functionCall.name.replaceAll('_', '-'); | |
| // Handle standard tools | |
| if (!allowedToolNames.has(functionCall.name as string)) { | |
| if (!allowedToolNames.has(normalizedToolName)) { | |
| const normalizedToolName = functionCall.name.replaceAll('-', '_'); | |
| // Handle standard tools | |
| if (!allowedToolNames.has(normalizedToolName)) { |
Summary
Details
Related Issues
How to Validate
Pre-Merge Checklist