Skip to content

fix(patch): cherry-pick bdf80ea to release/v0.18.0-pr-13600 to patch version v0.18.0 and create version 0.18.1#13861

Merged
SandyTao520 merged 1 commit intorelease/v0.18.0-pr-13600from
hotfix/v0.18.0/0.18.1/stable/cherry-pick-bdf80ea/pr-13600
Nov 26, 2025
Merged

fix(patch): cherry-pick bdf80ea to release/v0.18.0-pr-13600 to patch version v0.18.0 and create version 0.18.1#13861
SandyTao520 merged 1 commit intorelease/v0.18.0-pr-13600from
hotfix/v0.18.0/0.18.1/stable/cherry-pick-bdf80ea/pr-13600

Conversation

@gemini-cli-robot
Copy link
Copy Markdown
Collaborator

This PR automatically cherry-picks commit bdf80ea to patch version v0.18.0 in the stable release to create version 0.18.1.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Nov 26, 2025

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 @gemini-cli-robot, 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 refactors the exit mechanism for the CLI's extensions and mcp commands. It introduces a dedicated utility for exiting the process after ensuring necessary cleanup, and integrates this utility into all relevant command handlers. Additionally, it ensures that output listeners are initialized for these command groups, streamlining the CLI's operational flow and improving consistency.

Highlights

  • Centralized CLI Exit Logic: Introduced a new exitCli utility function that ensures runExitCleanup is called before the process exits. This centralizes the exit handling for CLI commands.
  • Refactored Command Exit: All extensions and mcp subcommands now explicitly call await exitCli() at the end of their handlers, ensuring consistent and proper cleanup and exit behavior.
  • Output Listener Initialization: The main extensions and mcp commands now use yargs.middleware to call initializeOutputListenersAndFlush() to ensure output listeners are properly set up before command execution.
  • Removed Redundant Exit Logic: A previous block of code in config.ts responsible for exiting after mcp or extensions commands has been removed, as the exit logic is now handled within the individual command handlers.
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.

Copy link
Copy Markdown
Contributor

@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 refactors the exit logic for extensions and mcp subcommands to use a centralized exitCli utility, ensuring cleanup actions are always performed. This is a good improvement for robustness. However, the refactoring is incomplete. Several command implementation files still contain direct calls to process.exit(1) in their error handling paths. These calls bypass the new exitCli utility and its cleanup logic, partially defeating the purpose of this change. It is critical to replace all process.exit(1) calls with await exitCli(1) to ensure consistent and correct exit behavior across all scenarios. I've added specific comments pointing out these inconsistencies.

name: argv['name'] as string,
scope: argv['scope'] as string,
});
await exitCli();
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.

critical

While this correctly uses the new exitCli utility for successful command execution, there's an inconsistent exit path within the handleDisable function in this file. On an error (line 45), handleDisable calls process.exit(1) directly, which will bypass the cleanup logic in exitCli. To ensure consistent behavior and proper cleanup on both success and failure, handleDisable should be updated to use await exitCli(1) for error exits.

allowPreRelease: argv['pre-release'] as boolean | undefined,
consent: argv['consent'] as boolean | undefined,
});
await exitCli();
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.

critical

While this correctly uses the new exitCli utility for successful command execution, there's an inconsistent exit path within the handleInstall function in this file. On an error (line 88), handleInstall calls process.exit(1) directly, which will bypass the cleanup logic in exitCli. To ensure consistent behavior and proper cleanup on both success and failure, handleInstall should be updated to use await exitCli(1) for error exits.

await handleLink({
path: argv['path'] as string,
});
await exitCli();
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.

critical

While this correctly uses the new exitCli utility for successful command execution, there's an inconsistent exit path within the handleLink function in this file. On an error (line 45), handleLink calls process.exit(1) directly, which will bypass the cleanup logic in exitCli. To ensure consistent behavior and proper cleanup on both success and failure, handleLink should be updated to use await exitCli(1) for error exits.

builder: (yargs) => yargs,
handler: async () => {
await handleList();
await exitCli();
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.

critical

While this correctly uses the new exitCli utility for successful command execution, there's an inconsistent exit path within the handleList function in this file. On an error (line 39), handleList calls process.exit(1) directly, which will bypass the cleanup logic in exitCli. To ensure consistent behavior and proper cleanup on both success and failure, handleList should be updated to use await exitCli(1) for error exits.

await handleUninstall({
names: argv['names'] as string[],
});
await exitCli();
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.

critical

While this correctly uses the new exitCli utility for successful command execution, there are inconsistent exit paths within the handleUninstall function in this file. On an error (lines 45 and 49), handleUninstall calls process.exit(1) directly, which will bypass the cleanup logic in exitCli. To ensure consistent behavior and proper cleanup on both success and failure, handleUninstall should be updated to use await exitCli(1) for error exits.

await handleValidate({
path: args['path'] as string,
});
await exitCli();
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.

critical

While this correctly uses the new exitCli utility for successful command execution, there's an inconsistent exit path within the handleValidate function in this file. On an error (line 30), handleValidate calls process.exit(1) directly, which will bypass the cleanup logic in exitCli. To ensure consistent behavior and proper cleanup on both success and failure, handleValidate should be updated to use await exitCli(1) for error exits.

excludeTools: argv['excludeTools'] as string[] | undefined,
},
);
await exitCli();
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.

critical

While this correctly uses the new exitCli utility for successful command execution, there's an inconsistent exit path within the addMcpServer function in this file. On an error (line 48), addMcpServer calls process.exit(1) directly, which will bypass the cleanup logic in exitCli. To ensure consistent behavior and proper cleanup on both success and failure, addMcpServer should be updated to use await exitCli(1) for error exits.

@github-actions
Copy link
Copy Markdown

Size Change: +388 B (0%)

Total Size: 21.1 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 21.1 MB +388 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@SandyTao520 SandyTao520 merged commit 013f984 into release/v0.18.0-pr-13600 Nov 26, 2025
21 checks passed
@SandyTao520 SandyTao520 deleted the hotfix/v0.18.0/0.18.1/stable/cherry-pick-bdf80ea/pr-13600 branch November 26, 2025 17:26
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.

3 participants