Repository navigation
fix(cli): preserve quota-interrupted sessions and stop on Escape - #29799
seokjeongeum wants to merge 1 commit into
Conversation
|
📊 PR Size: size/L
|
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 addresses a regression where conversation history was incorrectly rolled back during quota-related interruptions or user cancellations. By adjusting the session management logic, the application now preserves the latest user prompts and completed tool rounds, ensuring that sessions remain resumable after cleanup. Additionally, the CLI quota dialog has been updated to provide a more responsive experience by allowing users to stop the interaction using the Escape key. 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
|
There was a problem hiding this comment.
Code Review
This pull request updates the Gemini CLI to improve handling of quota errors and stream cancellations. Key changes include adding an Escape key handler to the ProQuotaDialog to allow users to retry later, updating GeminiChat to preserve user prompts and completed tool rounds when streams are aborted or encounter quota errors, and removing redundant history rollback logic. Comprehensive tests were added to verify session persistence and correct cancellation behavior under various error conditions. There are no review comments to address.
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
Summary
Keep the latest user prompt and completed tool rounds when a request stops for quota or cancellation, so normal quit/signout cleanup does not erase resumable conversation history. One Escape stops the quota retry dialog.
Details
Preserve history for terminal/retryable quota errors and cancellation, and recompute its prompt-token estimate instead of rolling back those turns. Other request failures retain the existing rollback behavior. Escape in the quota dialog chooses Stop and consumes the key once.
Regressions write real JSONL, run normal session cleanup, reload the record, and rebuild the client history. They also cover a completed tool call/result and signout's account-specific thought-signature cleanup. No authentication, public settings-schema, model-catalog, or package-version additions.
Related Issues
User-reported regression; no linked issue.
How to Validate
Validated final head
3ed37a028bf6267cd8a9b97dfe967160a8d1721f, based on upstreamed96faedfd5571f055c44f2c9509d62321d1138d.node node_modules/vitest/vitest.mjs run --root packages/core src/core/geminiChat.test.ts src/core/geminiChat.quota.test.ts src/core/geminiChat_network_retry.test.ts src/services/chatRecordingService.test.ts src/utils/sessionUtils.test.ts src/utils/delay.test.ts --coverage.enabled=false --maxWorkers=1 --minWorkers=1passes 230/230 on Linux Node 24.21.0 and native Windows Node 24.14.1.--root packages/cliandsrc/ui/components/ProQuotaDialog.test.tsx src/ui/hooks/useQuotaAndFallback.test.ts src/ui/commands/authCommand.test.ts src/ui/commands/quitCommand.test.tspasses 60/60 on both platforms.GeminiChat, uses realConfig/storage/recording with a fake content generator, and passes three real-file scenarios against source builds and installed core tarballs on Linux and native Windows: terminal quota then normal quit cleanup/resume; retryable quota then cleanup/resume; completed tool round then abort/signout signature cleanup/resume./quitexits 0, and the prompt remains in JSONL. Native Windows actual offline npm-exec from an isolated installed prefix passes the same product assertions, including CLI exit 0 and the saved prompt. Package smoke version/help checks are recorded separately from these feature assertions.GeminiChathash matches the intended history change. Packed CLI/core tarballs and resolved paths are checked separately. Native packages use extracted local tarballs and matching native dependency junctions after a bounded registry-install timeout; this does not claim a successful fresh registry installation.npm run start -- --versionand--helpalso exit 0 in the isolated checkout. The built artifact imagegemini-history-pr29799:3ed37a0passes all three JSONL cases and the actual npx Escape/quit flow under Linux Node 20.20.2 with external networking disabled. Repeating through native Windows -> WSL Docker also passes; these are Linux containers.npm run preflightcompleted on this head in a disposable Linux checkout under Node 20.19.0 with two Vitest workers. Install/format/build/full lint/all typechecks pass; tracked source remains clean. CLI reports 10 failed, 7,401 passed, 4 skipped; core reports 76 failed, 8,300 passed, 57 skipped. All 86 failing records reproduce on the matching upstream base with the same runtime, dependencies, isolated home, and worker bounds; no candidate-only failure. They concern mocked home/workspace paths, keychain mocks, and unavailablebwrap. Separately,npm run test:scriptspasses 202/202 andnpm run test:sea-launchpasses 17/17.Native source-fixture limitation: in the unbundled ConPTY run, explicitly choosing Stop and then typing
/quitis interpreted as another prompt on both this head and a correctly built/resolved upstream baseline. The matched probes fail identically; this is not counted as a fully passing source quit flow. The native packaged-npx flow and compiled JSONL scenarios pass. The local native terminal helper also retains handles after recording product exit 0; that helper teardown is distinguished from the CLI exit result.GitHub Testing: CI for this head reports
action_required; a maintainer must approve the external-contributor run. Local results do not imply CI passed. macOS/Seatbelt are unavailable. Podman fixtures remain pending because host sudo authentication is unavailable.Pre-Merge Checklist