perf(core): fix slow boot by fetching experiments and quota asynchronously#25758
perf(core): fix slow boot by fetching experiments and quota asynchronously#25758spencer426 merged 11 commits intomainfrom
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 dramatically improves the Gemini CLI's startup performance by converting critical network requests for experiments and user quota from synchronous blocking operations to asynchronous, non-blocking calls. This change addresses the root cause of high boot times, allowing the application to initialize more efficiently and responsively. The modifications ensure that the CLI can fetch necessary data in the background without delaying the user experience, while also updating dependencies and adapting tests to reflect the new asynchronous behavior. 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 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 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
|
There was a problem hiding this comment.
Code Review
This pull request refactors the Config initialization to handle experiments, admin controls, and user quotas asynchronously. Feedback highlights that this change introduces a race condition and violates the repository's initialization guidelines. Furthermore, removing the glob version override in package.json is identified as a security regression, as it leads to the use of deprecated dependency versions with known vulnerabilities.
|
Size Change: +114 B (0%) Total Size: 33.7 MB
ℹ️ View Unchanged
|
| model: 'gemini-3-flash', | ||
| debugMode: false, | ||
| }); | ||
| await config.initialize(); |
There was a problem hiding this comment.
The config.initialize() call was added here because the recent boot-time optimizations made experimentsPromise and quotaPromise asynchronous. Without explicitly waiting for initialization in the test setup, the tests were experiencing a race condition where the tracker tools were being evaluated before the system prompt and configuration context were fully loaded, causing flakes.
- Disabled `folderTrust` in `hierarchical_memory.eval.ts` to allow evaluations to run successfully without manual trust prompts in the untrusted test workspace. - Updated `TestRig` to preserve `GOOGLE_GEMINI_BASE_URL` in the subprocess environment, ensuring that E2E tests route through the local proxy instead of hitting the public API directly with proxy credentials, which previously caused silent fallback to older models.
…list (#25720) Co-authored-by: David Pierce <davidapierce@google.com> Co-authored-by: Keith Schaab <keithsc@google.com> Co-authored-by: Keith Schaab <keith.schaab@gmail.com> Co-authored-by: Emily Hedlund <ehedlund@google.com>
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
…ously (google-gemini#25758) Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com> Co-authored-by: David Pierce <davidapierce@google.com> Co-authored-by: Keith Schaab <keithsc@google.com> Co-authored-by: Keith Schaab <keith.schaab@gmail.com> Co-authored-by: Emily Hedlund <ehedlund@google.com>
Summary
This PR addresses the consistently high startup times of the Gemini CLI by refactoring the initialization sequence to perform network requests asynchronously.
Details
During initialization (
refreshAuth), the CLI was synchronously awaitingthis.experimentsPromiseandquotaPromise. Because the internal proxy (gemini_api_proxy) takes ~1.42s to boot and fetch experiments, these sequentialawaitcalls were directly blocking the CLI startup, compounding latency and causing 8–10s boot times.By removing the blocking
awaitstatements and chaining the dependent operations inside.then()and.catch(), these requests are now executed concurrently in the background. Tests inconfig.test.tsandtrackerTools.test.tswere updated to ensure the CLI waits for the asynchronous state viaconfig.initialize()appropriately.Related Issues
Fixes #25757
How to Validate
npm run preflight) passes successfully.Pre-Merge Checklist