gemini-cli - ✅(Solved) Fix Gemini CLI Slow Boot Times (up to 9.77s) [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25757Fetched 2026-04-22 08:03:28
View on GitHub
Comments
0
Participants
1
Timeline
7
Reactions
0
Participants
Timeline (top)
labeled ×3added_to_project_v2 ×1cross-referenced ×1issue_type_added ×1

Fix Action

Fixed

PR fix notes

PR #25758: perf(core): fix slow boot by fetching experiments and quota asynchronously

Description (problem / solution / changelog)

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 awaiting this.experimentsPromise and quotaPromise. Because the internal proxy (gemini_api_proxy) takes ~1.42s to boot and fetch experiments, these sequential await calls were directly blocking the CLI startup, compounding latency and causing 8–10s boot times.

By removing the blocking await statements and chaining the dependent operations inside .then() and .catch(), these requests are now executed concurrently in the background. Tests in config.test.ts and trackerTools.test.ts were updated to ensure the CLI waits for the asynchronous state via config.initialize() appropriately.

Related Issues

Fixes #25757

How to Validate

  1. Run the CLI and verify the startup time is significantly reduced.
  2. Ensure the preflight script (npm run preflight) passes successfully.
  3. Validate that UI components dependent on experiments and quota resolve correctly once loaded in the background.

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

Changed files

  • package-lock.json (modified, +389/-54)
  • package.json (modified, +1/-2)
  • packages/core/src/config/config.test.ts (modified, +4/-1)
  • packages/core/src/config/config.ts (modified, +21/-14)
  • packages/core/src/tools/trackerTools.test.ts (modified, +9/-2)
RAW_BUFFERClick to expand / collapse

What happened?

The Gemini CLI is experiencing consistently high startup times, taking up to 9.77 seconds to boot. During initialization, the CLI calls refreshAuth() which sets up the backend client models. In this process, the CLI synchronously awaits this.experimentsPromise (which fetches from the internal API proxy) and quotaPromise. The API proxy alone takes ~1.42 seconds to fetch its internal experiments and launch the HTTP server, and these sequential network requests significantly block the startup sequence.

What did you expect to happen?

The CLI should boot quickly, ideally taking around 4 seconds or less.

What is needed for this fix?

To resolve this issue, the sequential await calls in packages/core/src/config/config.ts (refreshAuth) must be decoupled.

  1. Remove await this.experimentsPromise; and await quotaPromise; from refreshAuth().
  2. Chain these promises asynchronously so that operations depending on them (e.g., setting request timeout, fetching admin controls, verifying pro model access) run concurrently via .then(...) and .catch(...).
  3. Update the tests in packages/core/src/config/config.test.ts and trackerTools.test.ts to accommodate the asynchronous configuration load, ensuring they wait for config.initialize() before asserting state.

Client information

Platform: Linux Version: Gemini CLI (Development)

Login information

Internal Proxy Authentication / Google Account

extent analysis

TL;DR

Decoupling the sequential await calls in refreshAuth() by chaining promises asynchronously can potentially reduce the Gemini CLI's startup time.

Guidance

  • Remove the synchronous await calls for this.experimentsPromise and quotaPromise in refreshAuth() to allow for concurrent execution.
  • Use .then() and .catch() to chain the promises and ensure that dependent operations are executed after the promises are resolved.
  • Update the tests in config.test.ts and trackerTools.test.ts to wait for config.initialize() before asserting state, accommodating the asynchronous configuration load.
  • Verify the startup time after applying these changes to ensure it meets the expected threshold of 4 seconds or less.

Example

// Before
async refreshAuth() {
  await this.experimentsPromise;
  await quotaPromise;
  // ...
}

// After
refreshAuth() {
  this.experimentsPromise
    .then(() => {
      // Operations depending on experimentsPromise
    })
    .catch((error) => {
      // Handle error
    });
  quotaPromise
    .then(() => {
      // Operations depending on quotaPromise
    })
    .catch((error) => {
      // Handle error
    });
}

Notes

The provided solution assumes that the sequential await calls are the primary cause of the high startup times. However, other factors might contribute to the delay, and additional optimizations might be necessary.

Recommendation

Apply the workaround by decoupling the sequential await calls and chaining the promises asynchronously, as this approach directly addresses the identified bottleneck in the startup sequence.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - ✅(Solved) Fix Gemini CLI Slow Boot Times (up to 9.77s) [1 pull requests, 1 participants]