Skip to content

Conversation

@IfCan666
Copy link

@IfCan666 IfCan666 commented Oct 29, 2025

TLDR

I just added back the old experience of "pressing Esc twice to cancel", and avoided triggering cancellation with just one press of Esc, reducing the likelihood of accidental triggering leading to exit or failed cancellation.#917.

Dive Deeper

The change is in the global key handling of packages/cli/src/ui/hooks/useGeminiStream.ts, where the cancel logic has been modified to "only cancel if double-pressing Esc within 500ms". The first press of Esc is only a "preparation", and the second press executes cancelOngoingRequest(). The original cancel process remains unchanged, calling AbortController.abort() and passing it through the same abortSignal to the tool scheduling and Shell execution service, thereby correctly interrupting the LLM stream and the running command.

Reviewer Test Plan

Testing Matrix

🍏 🪟 🐧
npm run ❓ ❓ ❓
npx ❓ ❓ ❓
Docker ❓ ❓ ❓
Podman ❓ - -
Seatbelt ❓ - -

Linked issues / bugs

issue:#914

@tanzhenxin
Copy link
Collaborator

@IfCan666 Thanks for your contribution!
Could you pls add PR description by following the template? It would be very helpful if the description has detailed explanation of the issue, the fix applied and test cases.

@pomelo-nwu pomelo-nwu self-requested a review October 31, 2025 07:47
@pomelo-nwu
Copy link
Collaborator

@IfCan666 Thanks for your contribution! I appreciate the effort to address issue #914. However, I have a few questions and concerns before we can proceed:

  1. Issue reproduction: Could you please confirm whether you were able to reproduce the exact scenario described in issue cancling the request by esc is not work as excepted in new version. #914 where "pressing the Esc key fails to cancel the request"? It would be helpful to understand:

  2. Breaking existing tests: The test suite explicitly expects single Esc press to cancel (useGeminiStream.test.tsx:871). Could you please update the tests to reflect the new double-press behavior, or explain why this change is necessary?

  3. UX consistency: I noticed that other parts of the codebase (like SettingsDialog) use single Esc press for cancellation, and the double-press pattern in InputPrompt includes visual feedback (setShowEscapePrompt). Have you considered adding user feedback for the cancellation "preparation" state to make the interaction clearer?

Once we better understand the root cause and address these concerns, we can move forward with the changes. Thanks again for your contribution!

@pomelo-nwu pomelo-nwu closed this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants