fix(cli): clear pending steering hints upon cancellation#26134
fix(cli): clear pending steering hints upon cancellation#26134JayadityaGit wants to merge 6 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 resolves a user experience bug in the CLI where cancelling an active turn inadvertently triggered a new turn with previously entered steering hints. The changes ensure that any buffered user input is properly discarded when a cancellation occurs, leading to a cleaner and more predictable interaction flow for users. 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.
We are adding consumeUserHint() in the useGeminiStream, so that pending steering hints will be cleared upon user request to cancel via ctrl+c or esc
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to clear pending user hints when an ongoing request is cancelled or interrupted in the Gemini CLI. The changes include adding a consumeUserHint callback to the useAgentStream and useGeminiStream hooks, updating the cancellation logic to invoke this callback, and adding corresponding unit tests. I have provided a suggestion to reorder the operations in useGeminiStream.ts to ensure the hint buffer is cleared before triggering state transitions, which helps prevent potential race conditions.
Note: Security Review is unavailable for this PR.
There was a problem hiding this comment.
we are doing the same as in the useGeminiStream, but this file is responsible for when the cli is managing the subagents, and there is a pending steering hint in this scenario
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
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. |
|
This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
Summary
This PR fixes a bug where cancelling a turn (via
ESCorCtrl+C) would immediately resubmit any pending user steering hints as a new turn.Details
The
AppContainermaintains a buffer of pending steering hints that have not yet been submitted. When a turn is active, these hints are queued. If the turn is cancelled, the state returns toIdle. AuseEffectinAppContainermonitors theIdlestate and, if it finds pending hints, automatically submits them.This change updates the
cancelOngoingRequesthandler in bothuseGeminiStreamanduseAgentStreamto consume (clear) the pending hint buffer during cancellation, preventing the unwanted automatic resubmission.Related Issues
Fixes #26133
How to Validate
sleep 10in a shell).ESCorCtrl+Cto cancel the turn.Automated tests:
npm test -w @google/gemini-cli -- src/ui/hooks/useGeminiStream.test.tsx src/ui/hooks/useAgentStream.test.tsxMeme
Pre-Merge Checklist