feat(core): Support GDC air-gapped Service Identity after auth library update#27956
Conversation
Summary of ChangesHello, 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 enables support for GDC air-gapped service identity token exchange. By leveraging recent updates in the underlying Google Auth library, the changes ensure that the apiEndpoint is correctly configured when the GOOGLE_VERTEX_BASE_URL environment variable is present, facilitating successful authentication in air-gapped environments. Highlights
Using Gemini Code AssistThe 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
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 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
|
|
📊 PR Size: size/M
|
There was a problem hiding this comment.
Code Review
This pull request adds support for injecting the Vertex AI base URL into the Google Auth client options when Vertex AI is enabled. It also updates the unit tests to assert this behavior and refactors existing assertions to use nested object matchers. The review feedback suggests a high-severity improvement: instead of reading the environment variable directly, the code should leverage the already resolved and validated baseUrl variable to ensure that custom base URLs configured via the configuration object are also supported.
Summary
Adds support for GDCH air-gapped service identity token exchange. The underlying
google-auth-librarywas recently updated to v10.7.0 ingoogle-cloud-nodePR which introduced support for this. This PR properly passes theapiEndpointtogoogleAuthOptions.clientOptionswhenGOOGLE_VERTEX_BASE_URLis set, allowing the auth library to correctly perform STS token exchange in GDCH environments.Details
The logic wraps
apiEndpointappropriately inclientOptionsinsidegoogleAuthOptions. A new test case has also been added tocontentGenerator.test.tsto assert thatapiEndpointis correctly populated.Related Issues
Fixes #27917
How to Validate
npm test -w @google/gemini-cli-core -- src/core/contentGenerator.test.tsGOOGLE_VERTEX_BASE_URLand verifying if the generated GoogleAuth instance includes theapiEndpoint.Pre-Merge Checklist