Skip to content

fix(native-chat): send on the Enter that commits a Hangul composition (#30159) - #30192

Merged
AmoabaKelvin merged 4 commits into
stablyai:mainfrom
CHOI-JOO-YEON:fix/native-chat-korean-ime-enter-submit
Oct 23, 2026
Merged

AmoabaKelvin merged 4 commits into
stablyai:mainfrom
CHOI-JOO-YEON:fix/native-chat-korean-ime-enter-submit

Conversation

@CHOI-JOO-YEON

@CHOI-JOO-YEON CHOI-JOO-YEON commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​18
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​18 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13

ELI5

When you type Korean in the chat box, the last letter is still "being built" when you press Enter. Orca treated that Enter like the Japanese/Chinese "pick this word" Enter and threw it away, so you had to press Enter a second time to send. Korean has no word-picking step, so now that one Enter finishes the letter and sends the message. Japanese and Chinese work the same as before.

What Changed

Before: In Chat view, typing 안녕하세요 with the Microsoft Korean IME and pressing Enter right after the last syllable only finished 요. The message went out on the second Enter. Typing a space first avoided it.

After: The same single Enter finishes 요 and sends 안녕하세요 once, with the last syllable in it, not missing and not doubled.

Mechanism: The chat composer uses the shared Enter gesture owner (useImeEnterGestureOwnership). Ending a composition with Enter produces two keydowns: the composing one (Process/229) and a plain Enter/13 sent again after compositionend. The owner remembers the first one and swallows the second, because for Japanese and Chinese that second Enter only confirms a candidate.

  • setComposing(false, committedText) now takes an optional committedText. If that text is only Hangul (\p{Script=Hangul}: syllables and jamo), the owner forgets the remembered Enter, so the second keydown goes through to the normal send path.
  • NativeChatComposerField passes compositionend's data through. The composer still owns the first, composing keydown, and the value has settled (onImeSettled) before the second keydown arrives. That keeps the [Bug]: Create-worktree name field duplicates the last Hangul syllable on Enter (missing isComposing guard) #9525 duplicated-syllable problem from coming back.
  • This doesn't depend on keyup timing, so it works for both orderings the owner already handles: Windows/Linux send the second Enter before keyup, macOS after.

Why

Hangul composition has no candidate-confirm step. The Enter that commits a syllable is the user's own Enter, and that's how native Windows/macOS text fields treat it. Basing the decision on the committed text, not on the platform or the IME, keeps everything else as it is:

Alternatives considered:

  • Skip the swallow when the keyboard layout is Korean. The renderer has no reliable signal for that, and it would wrongly let the Hanja-confirm Enter through.
  • Send on the composing keydown itself. That sends before the IME settles the value, which is the [Bug]: Create-worktree name field duplicates the last Hangul syllable on Enter (missing isComposing guard) #9525 failure.
  • Change the shared behavior for every caller. Other callers of the gesture owner don't pass text: ImeInput/ImeTextarea (so ui/input and ui/textarea, including the AskUserQuestion "Other" field), the quick-commands menu, the workspace comment box, and the file-explorer inline input. They work exactly as before. Each one can opt in later with one argument if wanted. I kept this PR to the reported surface.

Linked Issue

Fixes #30159

Visual Proof

Not attached yet. This changes keyboard behavior, and I have not recorded a before/after with a real Microsoft Korean IME session (see Testing). Recording to follow, or N/A if a maintainer prefers the automated coverage.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Not checked with a real Windows Korean IME session. The event sequences in the tests copy the orderings this hook already documents. Nobody has captured them from Microsoft Korean IME in DevTools yet.

Automated (run locally on Windows 11, Node 24.22.0, pnpm 12.8.1, Bun 1.4.3):

  • native-chat-composer-composition.test.tsx: I split the old Hangul "swallow" test into:
    • Hangul: the Enter reaches the composer once, after the value settles to 안녕하세요, for both the Windows and macOS orderings
    • Japanese 日本語: the confirm Enter is still swallowed, and the next Enter still submits, for both orderings
  • native-chat-structured-send-composition-clear.test.tsx: with the full composer, the Hangul message is sent once as 안녕하세요, and the Japanese confirm Enter sends nothing.
  • ime-composition-keyboard-event.test.ts:
    • a Hangul commit releases the remembered Enter
    • 日本語, 漢字, '' and no text keep it
    • the script check itself (isHangulCompositionCommit)
  • endComposition test helper: happy-dom has no CompositionEvent, so fireEvent.compositionEnd(el, { data }) drops data. The helper dispatches it with data set.
  • With the fix removed, the 4 new Hangul cases fail and the Japanese cases pass.

Commands:

  • pnpm typecheck: pass
  • pnpm lint: pass
  • pnpm run check:code-quality:changed: pass
  • oxfmt --check on changed files: pass
  • Vitest on src/renderer/src/components/native-chat, src/renderer/src/lib/ime*, src/renderer/src/components/tab-bar, src/renderer/src/components/sidebar/WorktreeMetaDialog*, src/renderer/src/components/right-sidebar/file-explorer*: 490 files / 5135 tests. One TabBar.context-menu.test.ts case hit the 30 s timeout under load, then passed on its own.
  • I did not run full pnpm test / pnpm build locally, because this machine has no Visual Studio build tools for the native node-pty rebuild. CI will cover those.

Manual check, Windows 11 + Microsoft Korean IME (2-set), Chat view:

  1. Type 안녕하세요 and press Enter right after 요. It should send once, the sent text should be 안녕하세요, and the composer should be empty afterwards, with no leftover 요.
  2. Type 한, press the Hanja key, pick 韓 with Enter. It should not send.
  3. Microsoft Japanese IME: type にほんご, press Space, press Enter to confirm. It should not send; the next Enter sends.
  4. Type 안녕 and press Shift+Enter. You should get a newline, not a send.

AI Disclosure

Written with Claude Code (Claude Opus 5.5). The cause was traced by reading the source, and the code and tests were written by the agent. A second agent pass reviewed the diff. The human reporter has not yet tried the fix with a real Korean IME.

Review

AI self-review:

  • Cross-platform: No platform checks were added. The script test is the same on macOS, Linux, and Windows, and both documented keydown/keyup orderings are tested. Linux IBus: NativeChatComposerField didn't use the IBus re-arm in onCompositionEnd() before this change, and still doesn't.
  • SSH/remote/local: Renderer-only keyboard handling. No change to RPC or transport.
  • Agents/integrations: Applies to every agent's Chat view composer the same way. Only the IME Enter decision changed.
  • Performance: One anchored regex test per compositionend.
  • Security: None.
  • Backwards compatibility: committedText is optional, and existing callers are unchanged.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Mobile: not touched (mobile/ has its own Korean IME handling).
  • Not covered here: Korean users in other ImeInput/ImeTextarea fields (e.g. AskUserQuestion "Other") still need two Enters there. That's the same opt-in applied to more surfaces, so I left it out to keep this PR focused.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred). lint and typecheck pass locally; test covered for the affected suites only; build left to CI

Maintainer changes

The fix is unchanged: Hangul-only compositionend data releases the remembered Enter, and only the chat composer passes the data. On top of it:

  • Merged current main into the branch.
  • Moved the Hangul check into the hook as a private regex. The exported isHangulCompositionCommit was only there for its own unit tests.
  • Trimmed the tests so each layer has one test. The full-composer test sends 안녕하세요 once on the committing Enter. The field test that used to pin the swallow with 가 now pins it with a Japanese commit (日本語), sent with real data through endComposition. The hook-level Hangul tests and the predicate table are gone, because the two composer tests cover the same behaviour. Both remaining tests fail when the fix is removed, and the Japanese one also fails when the rule is widened to any text.
  • Dropped the repeated comments.

Not in this PR: Korean users still need two Enters in ImeInput/ImeTextarea fields, the file-explorer rename, the workspace comment box and the quick-commands menu. Those fields can opt in later, one argument each. ime-text-field also needs the Hangul check before its IBus re-arm in onCompositionEnd.

Visual proof: N/A, keyboard-only change.

…stablyai#30159)

The chat composer swallowed the unmarked Enter that follows compositionend,
because for Japanese and Chinese that Enter only confirms a candidate. Korean
has no candidate step, so the same swallow made a message that ends in a
composing syllable need a second Enter.

The composer now passes compositionend's data to the shared Enter gesture
owner; a Hangul-only commit releases the carry so the redispatched Enter
reaches the send path after the value has settled. The composing keydown
itself is still owned, so the last syllable is not sent early or twice.
Other scripts, Hanja picks, and callers that pass no text keep the swallow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a9aa6ec4-4eca-40d1-bb7d-e2c3e6bf3bb4
📥 Commits

Reviewing files that changed from the base of the PR and between 904259d and d54b21e.

📒 Files selected for processing: 6
  • src/renderer/src/components/native-chat/NativeChatComposerField.tsx
  • src/renderer/src/components/native-chat/native-chat-composer-composition.test.tsx
  • src/renderer/src/components/native-chat/native-chat-prompt-editor.test-support.ts
  • src/renderer/src/components/native-chat/native-chat-structured-send-composition-clear.test.tsx
  • src/renderer/src/lib/ime-composition-keyboard-event.test.ts
  • src/renderer/src/lib/ime-composition-keyboard-event.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The composer now passes committed text to the IME Enter gesture hook when composition ends. The hook clears a pending Enter for Hangul-only committed text. Tests cover platform-specific Enter ordering, Hangul message sending, and Japanese candidate confirmation.

Fixed issue severity: <fixed_issue_severity>Medium</fixed_issue_severity>

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to d54b2

No confirmed issue prevents merging. The Windows Korean IME trace supports the intended Enter behavior, though it was not captured in the Chat composer.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Issue #30159 requires one Enter to commit a final Hangul syllable and send the Chat view message. NativeChatComposerField passes compositionend.data to useImeEnterGestureOwnership. The shared ow…
Out of Scope Changes check Passed The source changes stay within the Chat view composer and its shared IME Enter ownership API. Existing callers remain unchanged because the new argument is optional. The changed test helper and tests …
Title check Passed The title "fix(native-chat): send on the Enter that commits a Hangul composition (#30159)" names the main change: a Hangul commit Enter now sends in the Chat view composer. It matches the raw summary …
Description check Passed The description follows the template well. It has an ELI5, What Changed (before/after), Why with alternatives, Linked Issue (Fixes #30159), Visual Proof (explicitly N/A-style with reason, though not a…
Full details: Linked Issues check

Explanation

Issue #30159 requires one Enter to commit a final Hangul syllable and send the Chat view message. NativeChatComposerField passes compositionend.data to useImeEnterGestureOwnership. The shared owner releases the pending Enter for non-empty Hangul-only commits. The composer then receives the redispatched Enter after onImeSettled. Tests cover Hangul text, the Windows/Linux and macOS event orderings, and one send with the final syllable included. Tests also preserve Japanese confirmation behavior.

Full details: Out of Scope Changes check

Explanation

The source changes stay within the Chat view composer and its shared IME Enter ownership API. Existing callers remain unchanged because the new argument is optional. The changed test helper and tests directly verify the requested behavior and regression cases. No unrelated production behavior is introduced.

Full details: Title check

Explanation

The title "fix(native-chat): send on the Enter that commits a Hangul composition (#30159)" names the main change: a Hangul commit Enter now sends in the Chat view composer. It matches the raw summary and objectives. It is specific and conventional. The issue number in parentheses is a minor extra, not a defect.

Full details: Description check

Explanation

The description follows the template well. It has an ELI5, What Changed (before/after), Why with alternatives, Linked Issue (Fixes #30159), Visual Proof (explicitly N/A-style with reason, though not attached), Testing with manual steps and automated coverage, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. Gaps: the Visual Proof section is required for UI/behavior changes and no before/after is attached; the author says a recording will follow or N/A if maintainers prefer. Also the manual IME test is unchecked and the 'Manually tested' box is unchecked, and the checklist items for lint/typecheck/test/build are only partly checked. Those gaps are non-critical relative to the overall completeness, so the description is mostly complete.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AmoabaKelvin
AmoabaKelvin self-requested a review October 23, 2026 16:19
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.

[Bug]: Chat view composer on Windows needs Enter twice to send when the message ends with a composing Korean syllable

2 participants