Skip to content

feat: support GOOGLE_CLOUD_PROJECT_ID fallback (fixes #2262)#2725

Merged
swissspidy merged 1 commit intogoogle-gemini:mainfrom
Gosling-dude:fix-env-var-2262
Oct 9, 2025
Merged

feat: support GOOGLE_CLOUD_PROJECT_ID fallback (fixes #2262)#2725
swissspidy merged 1 commit intogoogle-gemini:mainfrom
Gosling-dude:fix-env-var-2262

Conversation

@Gosling-dude
Copy link
Contributor

This pull request enhances environment variable handling by introducing support for the GOOGLE_CLOUD_PROJECT_ID environment variable as a fallback to the existing GOOGLE_CLOUD_PROJECT variable.

What this fixes

Previously, the Gemini CLI only accepted GOOGLE_CLOUD_PROJECT for Google Cloud project identification. However, some users (especially those following other GCP tools or documentation) use GOOGLE_CLOUD_PROJECT_ID instead. This mismatch caused confusion and authentication issues, as highlighted in issue #2262.

What this PR does

  • Updates all relevant code paths to check both GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_PROJECT_ID, defaulting to the first available.
  • Ensures backward compatibility with existing users while supporting an alternative common variable name.
  • Improves robustness and reduces potential user misconfiguration when authenticating with Google Cloud.

Affected files

  • slashCommandProcessor.ts
  • setup.ts
  • contentGenerator.ts

Impact

This small but important enhancement increases flexibility and improves developer experience without introducing breaking changes.

Fixes: #2262

@Gosling-dude Gosling-dude requested a review from a team as a code owner June 30, 2025 17:42
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.

Summary of Changes

Hello @Gosling-dude, 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 enhances the application's flexibility by adding support for an alternative environment variable (GOOGLE_CLOUD_PROJECT_ID) for specifying the Google Cloud project. This change addresses user confusion and potential authentication issues, providing a more robust and user-friendly experience without introducing breaking changes.

Highlights

  • Environment Variable Fallback: Introduces support for GOOGLE_CLOUD_PROJECT_ID as a fallback to GOOGLE_CLOUD_PROJECT for Google Cloud project identification.
  • Backward Compatibility: Ensures existing users relying on GOOGLE_CLOUD_PROJECT are not affected by the change.
  • Improved Robustness: Reduces potential user misconfiguration when authenticating with Google Cloud.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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

The pull request effectively implements the fallback mechanism for GOOGLE_CLOUD_PROJECT_ID when GOOGLE_CLOUD_PROJECT is not set, aligning well with the stated objective of improving user experience and compatibility. The changes are minimal, well-contained, and consistently applied across the affected files. No critical or high-severity issues were identified during the review.

Comment on lines 7 to 8
//const gcpProject = process.env.GOOGLE_CLOUD_PROJECT || '';

Copy link
Contributor

Choose a reason for hiding this comment

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

This leftover code should be removed :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops! Removed it now — thanks for the heads-up! 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Happy to help! Just looks like you haven't pushed the change yet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just pushed the change now — thanks again for catching that! 🙌

@gemini-cli gemini-cli bot added good first issue priority/p2 Important but can be addressed in a future release. labels Jul 3, 2025
@Gosling-dude Gosling-dude requested a review from swissspidy July 14, 2025 04:53
swissspidy
swissspidy previously approved these changes Jul 14, 2025
Copy link
Contributor

@swissspidy swissspidy left a comment

Choose a reason for hiding this comment

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

We should also update the documentation, but otherwise LGTM

@Gosling-dude
Copy link
Contributor Author

We should also update the documentation, but otherwise LGTM

Hi @swissspidy,
I’ve added the documentation for the GOOGLE_CLOUD_PROJECT_ID fallback. All checks are passing now—please let me know if there’s anything else before merging. Thanks!

@Gosling-dude
Copy link
Contributor Author

@swissspidy @google-gemini/gemini-cli-askmode-approvers : could someone approve the workflow and give final review for PR #2725? Thanks!

@mattKorwel mattKorwel enabled auto-merge August 22, 2025 18:34
@mattKorwel mattKorwel self-assigned this Aug 22, 2025
@mattKorwel
Copy link
Collaborator

@Gosling-dude Trying to get this merged and I'm seeing what feels like an unrelated test failure. Can you try and pull and test on windows?

Thanks

auto-merge was automatically disabled August 23, 2025 02:25

Head branch was pushed to by a user without write access

@Gosling-dude
Copy link
Contributor Author

Gosling-dude commented Aug 24, 2025

@mattKorwel Preparing to push a clean branch with a single focused commit (env-var + docs) to fix the CLA commit-limit and simplify review. Before I push: do you allow a force-push to fix-env-var-2262? If not, I’ll push as a new branch/PR. After I push, could someone re-run CI / enable auto-merge? If the Windows job still fails, please share the failing test name/log and I’ll reproduce on Windows and fix. Thanks!

@gsquared94
Copy link
Contributor

@mattKorwel Preparing to push a clean branch with a single focused commit (env-var + docs) to fix the CLA commit-limit and simplify review. Before I push: do you allow a force-push to fix-env-var-2262? If not, I’ll push as a new branch/PR. After I push, could someone re-run CI / enable auto-merge? If the Windows job still fails, please share the failing test name/log and I’ll reproduce on Windows and fix. Thanks!

you should be able to force push since the branch in on your fork. It will however reset the approval.

@Gosling-dude
Copy link
Contributor Author

Hi @mattKorwel and @swissspidy,

I've pushed the cleaned-up branch as discussed. The pull request now has a single, focused commit and should be ready for a final review.

Could you please approve the workflows to run the CI checks?

Thanks!

@Gosling-dude Gosling-dude force-pushed the fix-env-var-2262 branch 2 times, most recently from abcfaea to ad88f43 Compare October 8, 2025 17:10
@Gosling-dude
Copy link
Contributor Author

@mattKorwel @swissspidy This update resolves all the previous issues. I've squashed the commits, fixed the linting errors, and rebased onto the latest main. This is now clean and ready for a final review and workflow approval.

@Gosling-dude Trying to get this merged and I'm seeing what feels like an unrelated test failure. Can you try and pull and test on windows?

Thanks

@swissspidy
Copy link
Contributor

Looks like you'll need to run Prettier again.

@Gosling-dude Gosling-dude force-pushed the fix-env-var-2262 branch 2 times, most recently from 69edd8e to ac814b4 Compare October 8, 2025 17:42
@Gosling-dude
Copy link
Contributor Author

Looks like you'll need to run Prettier again.

@swissspidy I've just pushed the fix for the formatting. All CI checks should be passing now. Ready for that final review!

@swissspidy swissspidy added this pull request to the merge queue Oct 8, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 8, 2025
@Gosling-dude
Copy link
Contributor Author

Hi @swissspidy and @mattKorwel,

I was able to get the detailed logs for the merge queue failure.

The failing job is E2E Test (macOS), and the specific test failing is file-system-interactive.test.ts with an assertion error (expected '1.0.0' to be '1.0.1').

This seems to confirm it's an unrelated test issue. Please let me know if there's anything else I can do to help!

@swissspidy swissspidy added this pull request to the merge queue Oct 9, 2025
Merged via the queue into google-gemini:main with commit 0cd490a Oct 9, 2025
19 checks passed
giraffe-tree pushed a commit to giraffe-tree/gemini-cli that referenced this pull request Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GOOGLE_CLOUD_PROJECT env var

4 participants