fix(desktop/composer): don't cancel in-flight turn on ESC while IME is composing - #7919
Open
chengoak wants to merge 1 commit into
Open
fix(desktop/composer): don't cancel in-flight turn on ESC while IME is composing#7919chengoak wants to merge 1 commit into
chengoak wants to merge 1 commit into
Conversation
chengoak
force-pushed
the
fix/composer-escape-ime-guard-v2
branch
2 times, most recently
from
August 8, 2026 05:07
0d20ae2 to
b6dafa2
Compare
Author
|
@SivanCola @esengine ping — when you have a moment, would appreciate a review on this small IME/ESC guard fix. Supersedes #6749 (which got stuck on |
chengoak
force-pushed
the
fix/composer-escape-ime-guard-v2
branch
3 times, most recently
from
August 8, 2026 10:14
8c4be1c to
06d61de
Compare
chengoak
force-pushed
the
fix/composer-escape-ime-guard-v2
branch
from
August 8, 2026 12:16
06d61de to
153b6d2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The composer's ESC handler unconditionally calls
handleCancel()whenever a turn is running, even when the ESC keydown was fired to dismiss a Chinese/Japanese IME candidate window. On macOS this is easy to hit while replying is streaming:ESCto dismiss the candidate.Root cause
desktop/frontend/src/components/Composer.tsx— the sameonKeyDownhandler that gates the send-Enter chord, the mention/past-chats menu, Shift+Tab plan toggle, and paste shortcuts with!composingwas missing that guard on the running-turn ESC branch:So an IME dismiss ESC on a running turn falls straight into
handleCancel().Fix
Add
!composingto the ESC guard. The existingisImeKeyEvent()helper already folds togethercomposingRef,nativeEvent.isComposing,keyCode === 229, and a short post-compositionendgrace window (IME_CONFIRM_GRACE_MS), socomposingis already the right signal — no new state or listeners.Diff: +4 / -1 (three lines are a comment explaining why, sized to stay within the project's
≤3 lines per non-declaration commentrule inREASONIX.md).Verification
Local Wails build (
main-v2HEAD + this patch, macOS arm64):ESCwhile the candidate window is open.Non-IME ESC behavior is unchanged:
ESCwith no composition andrunningstill cancels the turn as before (matches the Stop button's hint).Notes
desktop/frontend/src/components/Composer.tsx; no changes to the Go side or bindings.Documentation impact
Documentation-impact: none -
Composer.tsxis the user-facing chat composer, but this change is purely a behavior guard (don't treat ESC as an interrupt while the IME composition is active). No public API, no documented keybinding surface, no user-visible setting changes. The existing docs for the ESC interrupt / Stop button remain accurate as-is.Supersedes
This PR supersedes #6749, which I closed to restart the review queue. The previous PR was technically correct but got stuck for two reasons I want to be transparent about:
docs-impactwas failing — the original PR body didn't declare aDocumentation-impactfield, so theDocumentation impact guardcheck blocked it. Fixed in this PR's body.mergeable: UNKNOWNkept recurring —main-v2ships 20+ PRs per day, so the base moved forward between my force-pushes. The PR was repeatedly in a state where GitHub couldn't compute the merge.The patch itself is functionally identical to #6749 (same one-condition addition to the same guard). The only delta is the comment was tightened from 4 lines to 3 to stay within the project's
≤3 lines per non-declaration commentrule.@SivanCola @esengine — would appreciate a review when you have a moment. Happy to split into two commits (comment-only + one-line condition) if that's preferred.