Skip to content

fix(cli): convert hook timeout from seconds to milliseconds in hooks migration - #29125

Closed
0717lee wants to merge 2 commits into
google-gemini:mainfrom
0717lee:fix/hooks-migrate-timeout-unit
Closed

0717lee wants to merge 2 commits into
google-gemini:mainfrom
0717lee:fix/hooks-migrate-timeout-unit

Conversation

@0717lee

@0717lee 0717lee commented Aug 29, 2026

Copy link
Copy Markdown

Fixes #29122.

Claude Code measures hook timeouts in seconds (default 60), while Gemini CLI's hook runner interprets the value as milliseconds (DEFAULT_HOOK_TIMEOUT = 60000 in packages/core/src/hooks/hookRunner.ts). The migration copied the number verbatim, so a migrated "timeout": 30 became 30 ms instead of 30 s — the hook would time out almost instantly.

Changes

  • packages/cli/src/commands/hooks/migrate.ts: multiply the migrated timeout by 1000 and correct the unit comment
  • packages/cli/src/commands/hooks/migrate.test.ts: update the two existing assertions that encoded the buggy behavior (30 → 30000) and rework the preserve-timeout test to verify the seconds→milliseconds conversion (60 → 60000)

Testing

  • npx vitest run src/commands/hooks/migrate.test.ts — 17/17 pass
  • npm run typecheck (cli package) and eslint on the changed files — clean

…migration

Claude Code measures hook timeouts in seconds (default 60), while
Gemini CLI's hook runner interprets the value as milliseconds
(DEFAULT_HOOK_TIMEOUT = 60000). The migration copied the number
verbatim, so a migrated "timeout": 30 became 30ms instead of 30s.

Fixes google-gemini#29122
@0717lee
0717lee requested a review from a team as a code owner August 29, 2026 07:07
@google-cla

google-cla Bot commented Aug 29, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 addresses a bug where hook timeouts were incorrectly migrated from Claude to Gemini CLI. Because the two systems measure timeouts in different units (seconds vs. milliseconds), the previous implementation caused hooks to time out prematurely. The changes ensure that migrated timeout values are correctly scaled to milliseconds during the migration process.

Highlights

  • Timeout Unit Conversion: Updated the hook migration logic to convert timeout values from seconds to milliseconds by multiplying by 1000, ensuring compatibility with the Gemini CLI hook runner.
  • Test Suite Updates: Refactored existing tests to reflect the new millisecond-based timeout values and updated test descriptions to accurately document the conversion behavior.
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 the 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 counterproductive. 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

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

@github-actions github-actions Bot added the size/s A small PR label Aug 29, 2026
@github-actions

Copy link
Copy Markdown

📊 PR Size: size/S

  • Lines changed: 10
  • Additions: +5
  • Deletions: -5
  • Files changed: 2

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

Copy link
Copy Markdown
Contributor

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 updates the hook migration logic to convert timeout values from seconds (used by Claude) to milliseconds (used by Gemini). It modifies the migration implementation in migrate.ts to multiply the timeout value by 1000, and updates the corresponding unit tests in migrate.test.ts to assert the converted millisecond values. There are no review comments, so I have no feedback to provide.

@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality labels Aug 29, 2026
@gemini-cli

gemini-cli Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Hi there! Thank you for your interest in contributing to Gemini CLI.

To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'.

This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

@0717lee

0717lee commented Sep 6, 2026

Copy link
Copy Markdown
Author

Thanks for the policy note. This PR fixes #29122, a triaged P2 bug (kind/bug, area/core, effort/small, status/bot-triaged), and is green: CLA signed, all checks passing, mergeable. If this falls within the community-contribution scope, could a maintainer add the help wanted designation to the linked issue so the PR stays reviewable? If it's roadmap-reserved or otherwise not wanted, feel free to close it — the branch will stay on my fork in case the issue gets labeled later.

@gemini-cli

gemini-cli Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality priority/p2 Important but can be addressed in a future release. size/s A small PR status/pr-nudge-sent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hooks: migrate copies Claude's timeout across a seconds → milliseconds unit change

1 participant