Repository navigation
fix(cli): resolve hang on Enter keypress in interactive mode (#23297) - #29476
elberthc-byte wants to merge 7 commits into
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 addresses a UI hang in the Gemini CLI where pressing 'Enter' on confirmation prompts would become unresponsive due to synchronous waiting on IDE companion operations. By decoupling the confirmation event dispatch from the IDE diff closing process and implementing stricter, more resilient timeout handling, the CLI now remains responsive even when the IDE connection experiences latency or timeouts. 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
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request improves the robustness of the resolveDiffFromCli method by introducing a dedicated timeout (IDE_CLOSE_DIFF_TIMEOUT_MS) and adding error handling to prevent closeDiff failures from blocking the UI or message bus. Corresponding unit tests were added to verify that hanging or failing closeDiff calls are handled gracefully. I have no feedback to provide.
There was a problem hiding this comment.
Code Review
This pull request improves the robustness of the IDE diff resolution process by preventing hanging or failing resolveDiffFromCli calls from blocking the CLI's message bus or tool confirmation flow. Specifically, resolveDiffFromCli is now called asynchronously and safely caught in ToolActionsProvider, the timeout for closing a diff has been reduced from 10 minutes to 5 seconds, and errors during closeDiff are caught and logged rather than throwing. Corresponding unit tests have been added to verify these non-blocking behaviors. I have no feedback to provide as there are no review comments to evaluate.
5029d88 to
7fe54ed
Compare
🛑 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. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request improves the robustness of IDE diffing interactions by preventing hangs and unblocking the message bus when IDE client operations delay or fail. Key changes include wrapping IDE confirmation promises in races with timeouts, dynamically fetching the IdeClient instance, and handling errors gracefully during diff closure. Feedback on these changes highlights two critical issues: a potential resource leak where a setTimeout is not cleared after a Promise.race settles, and a concurrency bug in ide-client.ts where registering resolvers before acquiring the mutex can overwrite queued diffs on the same file path.
106124f to
5029d88
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request ensures that diff resolution in the IDE client does not block or fail the main application flow. In ToolActionsProvider, resolveDiffFromCli is now called asynchronously without being awaited, with errors caught and logged. In IdeClient, the timeout for closing a diff is reduced to 5 seconds, and resolveDiffFromCli wraps closeDiff in a try-catch block to guarantee that the resolver is cleaned up and resolved even on failure. Comprehensive unit tests have been added to verify these robustness improvements. I have no feedback to provide as there are no review comments to evaluate.
|
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
Fixes an issue where pressing
Enteron tool confirmation prompts (such as file edit approvals) appears unresponsive when running Gemini CLI in an integrated terminal with IDE companion integration enabled (#23297).This pull request decouples user confirmation event publication from IDE diff closing side-effects so that slow, delayed, or interrupted IDE companion connections cannot block
MessageBusevent dispatch or freeze interactive terminal input.Details
Problem
When an
edittool requests user confirmation,ToolActionsContext.tsxwas sequentiallyawaitingideClient.resolveDiffFromCli(details.filePath, cliOutcome)before publishingTOOL_CONFIRMATION_RESPONSEto theMessageBus.If the IDE companion connection experienced latency, socket disconnects, or header timeouts (
UND_ERR_HEADERS_TIMEOUT), the 10-minute timeout oncloseDiffor an unhandled rejection permanently blocked the confirmation dispatch. Because the scheduler never received the user's confirmation response, the CLI remained waiting on the approval prompt. Keyboard navigation (Up/Down arrow keys) still updated local UI state, but pressingEnterhad no effect.Implementation Logic (Surgical Fix)
packages/cli/src/ui/contexts/ToolActionsContext.tsx):resolveDiffFromCli()asynchronously in the background using optional chaining and.catch(...)logging.TOOL_CONFIRMATION_RESPONSEtoMessageBusimmediately upon pressingEnter, allowing the scheduler to advance and dismiss the prompt instantly.packages/core/src/ide/constants.ts&ide-client.ts):IDE_CLOSE_DIFF_TIMEOUT_MS = 5000(5 seconds) specifically forcloseDiffoperations, preserving the 10-minuteIDE_REQUEST_TIMEOUT_MSfor human review duringopenDiff.resolveDiffFromCli()before executingcloseDiffto prevent tab-close notifications from racing with CLI approvals.closeDiffin atry/catchblock to guarantee resolver cleanup even if the IDE companion connection aborts or times out.Related Issues
Fixes #23297
Related to #24830
How to Validate
1. Automated Tests
Run the updated unit test suites in both
packages/cliandpackages/core:Expected output: All 37 tests pass (10 in CLI, 27 in core).
2. Full Workspace Build Verification
Clean and rebuild workspace packages:
npm run clean && npm run buildExpected output: Clean build completion across all packages and devtools client bundling without errors.
3. Manual Interactive Verification
/ide enable).Enteron "Allow once".Pre-Merge Checklist