Skip to content

fix(cli): do not override GOOGLE_CLOUD_PROJECT in Cloud Shell when using Vertex AI#24455

Merged
DavidAPierce merged 20 commits intomainfrom
vertex-project
Apr 30, 2026
Merged

fix(cli): do not override GOOGLE_CLOUD_PROJECT in Cloud Shell when using Vertex AI#24455
DavidAPierce merged 20 commits intomainfrom
vertex-project

Conversation

@jackwotherspoon
Copy link
Copy Markdown
Collaborator

@jackwotherspoon jackwotherspoon commented Apr 1, 2026

Summary

Fixes an issue where GOOGLE_CLOUD_PROJECT was being incorrectly overridden to cloudshell-gca in Cloud Shell even when the user had explicitly selected Vertex AI authentication.

vertex.-.cloud.shell.mp4

Details

In Cloud Shell, the CLI normally overrides GOOGLE_CLOUD_PROJECT to a default value (cloudshell-gca) to avoid using the project set via gcloud. However, when using Vertex AI, users often intend to use a specific project. This change ensures that if selectedAuthType is vertex-ai, the override is skipped, respecting the existing environment or .env settings.

When in Cloud Shell, if a user switches to Vertex auth, it tells the user to restart to make sure the project gets picked up.

Related Issues

Fixes #24494

How to Validate

  1. Simulate Cloud Shell environment (export CLOUD_SHELL=true).
  2. Set a custom GOOGLE_CLOUD_PROJECT.
  3. Run the CLI with Vertex AI auth type configured in settings.
  4. Verify GOOGLE_CLOUD_PROJECT remains as set by the user/env.

Automated tests added in packages/cli/src/config/settings.test.ts.

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

@jackwotherspoon jackwotherspoon requested a review from a team as a code owner April 1, 2026 19:04
@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 an issue where the CLI's default behavior in Cloud Shell was overriding user-defined project settings. By introducing a check for the selected authentication type, the system now correctly respects user configurations when Vertex AI is in use, ensuring a more predictable environment setup.

Highlights

  • Environment Variable Override: Modified the CLI to prevent the automatic override of GOOGLE_CLOUD_PROJECT when running in Cloud Shell if the user has explicitly selected Vertex AI authentication.
  • Testing: Added a new test case in settings.test.ts to verify that the project environment variable is preserved when Vertex AI auth is configured.
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.

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
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

Size Change: +1.61 kB (0%)

Total Size: 33.9 MB

Filename Size Change
./bundle/chunk-735W5KSB.js 0 B -655 kB (removed) 🏆
./bundle/chunk-FSIYSSKX.js 0 B -2.72 MB (removed) 🏆
./bundle/chunk-HF77AZSK.js 0 B -14.7 MB (removed) 🏆
./bundle/chunk-IY5SPMEO.js 0 B -12.6 kB (removed) 🏆
./bundle/chunk-QXWJ2XAV.js 0 B -3.8 kB (removed) 🏆
./bundle/chunk-RFRWNJHM.js 0 B -49.2 kB (removed) 🏆
./bundle/chunk-TZ37FKGG.js 0 B -3.43 kB (removed) 🏆
./bundle/chunk-YOMDEJKW.js 0 B -19.5 kB (removed) 🏆
./bundle/core-DH35SGGM.js 0 B -48.2 kB (removed) 🏆
./bundle/devtoolsService-SGJ636CT.js 0 B -28 kB (removed) 🏆
./bundle/gemini-JNF5OR4L.js 0 B -580 kB (removed) 🏆
./bundle/interactiveCli-JLCUTCQJ.js 0 B -1.32 MB (removed) 🏆
./bundle/liteRtServerManager-WBGL57QK.js 0 B -2.11 kB (removed) 🏆
./bundle/oauth2-provider-3QMSWT2R.js 0 B -9.16 kB (removed) 🏆
./bundle/chunk-4DDTJMOP.js 656 kB +656 kB (new file) 🆕
./bundle/chunk-4VLGNBTT.js 19.5 kB +19.5 kB (new file) 🆕
./bundle/chunk-BYMZSYLX.js 3.43 kB +3.43 kB (new file) 🆕
./bundle/chunk-CKIUH7AN.js 3.8 kB +3.8 kB (new file) 🆕
./bundle/chunk-G3Q5HMUK.js 14.7 MB +14.7 MB (new file) 🆕
./bundle/chunk-ONZBBLJK.js 12.6 kB +12.6 kB (new file) 🆕
./bundle/chunk-TJPTBEE7.js 49.2 kB +49.2 kB (new file) 🆕
./bundle/chunk-TV4JE552.js 2.72 MB +2.72 MB (new file) 🆕
./bundle/core-JQ4Q2TON.js 48.2 kB +48.2 kB (new file) 🆕
./bundle/devtoolsService-GJYJYYHM.js 28 kB +28 kB (new file) 🆕
./bundle/gemini-QUGUMBCQ.js 580 kB +580 kB (new file) 🆕
./bundle/interactiveCli-N6LZ3JP6.js 1.32 MB +1.32 MB (new file) 🆕
./bundle/liteRtServerManager-5QLK2QYF.js 2.11 kB +2.11 kB (new file) 🆕
./bundle/oauth2-provider-TJ3ZGCHM.js 9.16 kB +9.16 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./bundle/bundled/third_party/index.js 8 MB 0 B
./bundle/chunk-34MYV7JD.js 2.45 kB 0 B
./bundle/chunk-5AUYMPVF.js 858 B 0 B
./bundle/chunk-5PS3AYFU.js 1.18 kB 0 B
./bundle/chunk-664ZODQF.js 124 kB 0 B
./bundle/chunk-DAHVX5MI.js 206 kB 0 B
./bundle/chunk-IUUIT4SU.js 56.5 kB 0 B
./bundle/chunk-RJTRUG2J.js 39.8 kB 0 B
./bundle/chunk-XRLFHCHC.js 1.97 MB 0 B
./bundle/cleanup-AIAZ27RV.js 0 B -932 B (removed) 🏆
./bundle/devtools-36NN55EP.js 696 kB 0 B
./bundle/dist-T73EYRDX.js 356 B 0 B
./bundle/events-XB7DADIJ.js 418 B 0 B
./bundle/examples/hooks/scripts/on-start.js 188 B 0 B
./bundle/examples/mcp-server/example.js 1.43 kB 0 B
./bundle/gemini.js 5.1 kB 0 B
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB 0 B
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB 0 B
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB 0 B
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB 0 B
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB 0 B
./bundle/memoryDiscovery-FN3IAPBT.js 980 B 0 B
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 222 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 229 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 13.4 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 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-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B
./bundle/src-QVCVGIUX.js 47 kB 0 B
./bundle/start-7YVXZKNB.js 0 B -652 B (removed) 🏆
./bundle/tree-sitter-7U6MW5PS.js 274 kB 0 B
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB 0 B
./bundle/cleanup-2WNI6QSM.js 932 B +932 B (new file) 🆕
./bundle/start-X5UUMXZZ.js 652 B +652 B (new file) 🆕

compressed-size-action

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 modifies the Cloud Shell environment setup to ensure that the GOOGLE_CLOUD_PROJECT environment variable is not overridden when the vertex-ai authentication type is selected. This change allows the CLI to respect the user's project configuration in Vertex AI environments. The update includes a new unit test to validate this logic. I have no feedback to provide.

@gemini-cli gemini-cli Bot added the status/need-issue Pull requests that need to have an associated issue. label Apr 1, 2026
@JayadityaGit
Copy link
Copy Markdown
Contributor

JayadityaGit commented Apr 9, 2026

Whoaa we seem to have amazing redesign and refactoring here love it , i looked at the diff changes seems like those went like major changes (i just looked at them)

I love the UX improvements and the refactors !

it seems like the old issue still persists, which is the restart dialog seems to linger after exiting the session, (i just ran the changes locally)

Screenshot from 2026-04-09 20-12-01

I personally feel like we can fix this bug with this PR itself !

@jackwotherspoon
Copy link
Copy Markdown
Collaborator Author

I personally feel like we can fix this bug with this PR itself !

Sweet, let me tackle the final piece here 👍 Thanks @JayadityaGit

@JayadityaGit
Copy link
Copy Markdown
Contributor

JayadityaGit commented Apr 9, 2026

one final note I am including this issue #24505 , this was triaged as p3 (i feel this is a sub part of this PR)

anyways thanks !

@JayadityaGit
Copy link
Copy Markdown
Contributor

i apologise for not communicating this sooner., by default i actually use Alternate screen buffer mode, where with a successfull google sign in

  1. restart dialog in the actual session clears off
  2. but still lingers after exiting the cli (creating unecessary noise)

i just switched to normal mode to check if it make any difference, in this mode after successful sign in

  1. restart dialog in the session still persists
  2. also lingers after exiting the cli

I just wanted to communicate this, thanks for making the cli better 💚.

@gemini-cli gemini-cli Bot added area/security Issues related to security and removed status/need-issue Pull requests that need to have an associated issue. labels Apr 15, 2026
@DavidAPierce
Copy link
Copy Markdown
Contributor

Howdy @jackwotherspoon this PR looks good and largely addresses two birds with one stone. LGTM.

@DavidAPierce DavidAPierce enabled auto-merge April 30, 2026 17:38
@DavidAPierce DavidAPierce added this pull request to the merge queue Apr 30, 2026
Merged via the queue into main with commit c94edcd Apr 30, 2026
26 of 27 checks passed
@DavidAPierce DavidAPierce deleted the vertex-project branch April 30, 2026 18:06
TirthNaik-99 pushed a commit to TirthNaik-99/gemini-cli that referenced this pull request May 4, 2026
…ing Vertex AI (google-gemini#24455)

Co-authored-by: David Pierce <davidapierce@google.com>
kimjune01 pushed a commit to kimjune01/gemini-cli-claude that referenced this pull request May 6, 2026
…ing Vertex AI (google-gemini#24455)

Co-authored-by: David Pierce <davidapierce@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/security Issues related to security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vertex AI Authentication in Cloud Shell (on Google Cloud) is not working.

3 participants