Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gundermanc
Copy link
Member

@gundermanc gundermanc commented Dec 10, 2025

Summary

Adds an await to clearSettings() function's keychain.isAvailable() branch. Previously, this code was inadvertently checking the truthiness of the returned promise instead of the underlying boolean resulting in it never being run.

I discovered this while trying to enable various eslint promise correctness rules. I am not sure there is user visible misbehavior but it looks as though it might cause an error to bubble up to the user when there is no keychain available.

As a follow up, we should enable a broader set of eslint rules to prevent similar pitfalls.

How to Validate

Run the provided unit test before and after the change.

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

@gundermanc gundermanc requested a review from a team as a code owner December 10, 2025 19:36
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @gundermanc, 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 resolves a subtle but critical bug within the clearSettings function, where the asynchronous keychain.isAvailable() call was not properly awaited. This oversight led to the conditional logic evaluating the promise object itself rather than its resolved boolean value, potentially causing incorrect behavior or errors when the keychain was not accessible. The change ensures robust handling of keychain availability, and a new unit test has been added to confirm this corrected behavior.

Highlights

  • Bug Fix: Missing Await: Corrected a logical error in the clearSettings function by adding a missing await keyword to the keychain.isAvailable() call. This ensures the function correctly checks the boolean result of the promise instead of its truthiness.
  • New Unit Test: Introduced a new unit test case in extensionSettings.test.ts to specifically validate that clearSettings properly handles scenarios where the keychain is unavailable, preventing attempts to clear secrets.
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
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 correctly fixes a critical bug where a missing await on an asynchronous call could lead to an unhandled promise rejection and a potential crash when the keychain is unavailable. The fix is simple, correct, and effectively resolves the issue. Additionally, a new unit test has been added that thoroughly validates the fix, ensuring this regression won't occur in the future. The changes are excellent and improve the robustness of the application.

@github-actions
Copy link

Size Change: +4 B (0%)

Total Size: 21.6 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 21.6 MB +4 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

@gundermanc gundermanc added this pull request to the merge queue Dec 10, 2025
Merged via the queue into main with commit 648041c Dec 10, 2025
19 of 20 checks passed
@gundermanc gundermanc deleted the gundermanc/missing-await branch December 10, 2025 20:06
psinha40898 pushed a commit to psinha40898/gemini-cli that referenced this pull request Dec 10, 2025
thacio added a commit to thacio/auditaria that referenced this pull request Dec 11, 2025
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.

2 participants