Skip to content

fix(core): normalize tool names with underscores - #3

Merged
aka76bm merged 6 commits into
aka76bm:mainfrom
start-export-MA:main
Nov 9, 2025
Merged

aka76bm merged 6 commits into
aka76bm:mainfrom
start-export-MA:main

Conversation

@aka76bm

@aka76bm aka76bm commented Nov 9, 2025

Copy link
Copy Markdown
Owner

Summary

Details

Related Issues

How to Validate

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

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.
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @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

  • Core: Tool Name Normalization: The agent executor now normalizes tool names by replacing underscores with hyphens. This ensures consistent handling and validation of tool calls, regardless of whether the incoming tool name uses underscores or hyphens.
  • Documentation: Code of Conduct: A new CODE_OF_CONDUCT.md file has been added, adopting the Contributor Covenant. The CONTRIBUTING.md file has been updated to include a section that directs contributors to review this new Code of Conduct and provides a note for maintainers regarding contact method configuration.
  • Build/Scripts: Linter Platform Compatibility: The lint.js script has been enhanced to gracefully handle unsupported platforms, specifically Windows. Platform-specific linters like actionlint and shellcheck are now configured as no-ops on platforms where they are not supported, preventing build failures.
  • Chore: Formatting Cleanup: Minor formatting adjustments were made in package-lock.json and packages/cli/package.json, primarily involving the removal of blank lines.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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

  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. ↩

@gemini-code-assist gemini-code-assist Bot 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.

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.

Comment on lines +506 to +509
const normalizedToolName = functionCall.name.replaceAll('_', '-');

// Handle standard tools
if (!allowedToolNames.has(functionCall.name as string)) {
if (!allowedToolNames.has(normalizedToolName)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

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.

Suggested change
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)) {

@aka76bm
aka76bm merged commit fd3c568 into aka76bm:main Nov 9, 2025
1 of 5 checks passed
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.

1 participant