Skip to content

fix(new-workspace): ignore IME composition Enter in workspace name field - #9526

Merged
AmethystLiang merged 2 commits into
stablyai:mainfrom
shinju4n:fix/workspace-name-ime-composition
Jul 20, 2026
Merged

AmethystLiang merged 2 commits into
stablyai:mainfrom
shinju4n:fix/workspace-name-ime-composition

Conversation

@shinju4n

@shinju4n shinju4n commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #9525

Summary

Typing a CJK workspace name (Korean/Japanese/Chinese) in the create-worktree dialog and pressing Enter while the last syllable is still composing duplicates that syllable — 배포 becomes 배포포, and the wrong name flows into the created workspace/branch.

Root cause: the Enter handler in SmartWorkspaceNameField treats the IME-composition Enter (the keypress that only finalizes the candidate) as a real Enter and runs onPlainEnter(), which moves focus to the Agent combobox. Moving focus mid-composition makes Chromium re-commit the composing character into the controlled input, appending it a second time.

Fix: guard the Enter branch with the existing shared helper isImeCompositionKeyDown() (nativeEvent.isComposing || keyCode === 229) — the exact pattern this codebase already uses in WorktreeTitleInlineRename, AddRepoRemoteStep, AddRepoCloneStep, JiraIssueWorkspace, and the TaskPage Enter handlers. The smart workspace-name field was the one Enter-commit path missing it. After the fix, the first Enter finalizes the composition (field keeps the correct text, focus stays put) and the next Enter advances focus as before — matching the inline-rename field's behavior.

Related: #8038 tracks the same missing-guard family in the desktop terminal. Tab/native focus traversal was verified unaffected (the browser-native focus move lets the IME finalize correctly; only the JS-initiated focus move triggered the re-commit).

Screenshots

Before (Orca v1.4.146 stable, macOS Korean 2-Set IME) — typing 테스트, pressing Enter mid-composition yields 테스트트:

orca-ime-bug-repro.mp4

After (this branch, dev build, same IME) — same input, name stays 테스트, focus advances on the following Enter:

orca-ime-fix-after.mp4

Testing

  • pnpm typecheck — clean (node, cli, web)
  • pnpm test — 32,326 passed, 56 skipped, 1 baseline-only failure (see below)
  • pnpm lint — my files clean; 2 baseline-only errors (see below)
  • pnpm build — fails locally on an environment limitation only (see below)
  • Added SmartWorkspaceNameField.ime-enter.test.tsx (happy-dom render of the real component):
    • Enter with isComposing: true → onPlainEnter NOT called
    • Enter with keyCode === 229 (IMEs that skip isComposing on keydown) → onPlainEnter NOT called
    • plain Enter → onPlainEnter called once (no regression)
    • Verified the two guard tests fail on main and pass with this change.
  • Manual verification on a local dev build with the macOS Korean IME (recording above): duplication gone, Enter-to-advance-focus still works, popover row selection via Enter unaffected for non-IME input.

Baseline-only failures — this branch differs from main by exactly the two files in this diff (git diff main --name-only), so all of the following reproduce identically on clean main:

AI Review Report

Reviewed the diff with my AI coding agent. Main risks checked and results:

  • Cross-platform (macOS/Linux/Windows): the guard uses standard DOM KeyboardEvent.isComposing plus the keyCode === 229 fallback; no platform branches, no shortcuts/labels/paths/shell involvement. Behavior on Linux (IBus) and Windows (IME) IMEs follows the same keydown contract; non-IME input is unaffected because isComposing is false and keyCode is the real key.
  • SSH/remote/local: renderer-only change in a local input handler; no daemon/relay/SSH surface touched.
  • Agents/integrations/git providers: the guard sits before both Enter branches (source-row select and plain-Enter), so GitHub/GitLab/Linear/Jira source selection behavior is unchanged for non-composition Enter; no provider-specific logic added.
  • Performance: one boolean check on Enter keydown; no hot-path impact.
  • UI quality: no visual change; keyboard flow now matches the already-fixed inline-rename field.
  • Flagged and accepted: an IME-composition Enter now does nothing beyond finalizing the composition (previously it advanced focus with corrupted text) — this is the intended, standard behavior for CJK inputs and matches WorktreeTitleInlineRename.

Security Audit

  • No new dependencies; no changes to IPC, network, filesystem, process spawning, or credential handling.
  • Change is limited to interpreting a keyboard event in the renderer; no user data crosses any new boundary.

Notes

  • The same isImeCompositionKeyDown helper is intentionally reused rather than a new predicate, keeping IME-Enter semantics consistent across the app.
  • No platform-specific code added; manually verified on macOS (the platform where the bug was reported).

An Enter that only commits a CJK IME candidate (Korean/Japanese/Chinese)
was handled as a real Enter by the smart workspace name field, moving
focus mid-composition. Chromium then re-commits the composing character
into the controlled input, duplicating the last syllable (e.g. typing
a Korean name and pressing Enter turned it into the name plus a repeated
final syllable).

Guard the Enter branch with the existing isImeCompositionKeyDown helper,
matching WorktreeTitleInlineRename and the other Enter handlers that
already check nativeEvent.isComposing / keyCode 229.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

SmartWorkspaceNameField now detects IME composition during Enter keydown events and exits before selection or focus logic runs. A new Vitest/React test suite mocks required dependencies, manages a DOM root per test, dispatches Enter events, and verifies behavior for isComposing, keyCode: 229, standard Enter input, and smart-mode row selection.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement the missing IME Enter guard and add regression tests for the behavior described in #9525.
Out of Scope Changes check ✅ Passed The PR stays focused on the workspace name field bug fix and related tests, with no unrelated code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely summarizes the IME Enter guard added to the workspace name field.
Description check ✅ Passed The description matches the template well, covering summary, screenshots, testing, AI review, security audit, and notes.

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.

@AmethystLiang
AmethystLiang self-requested a review July 20, 2026 07:02
…anch

Add a differential pair (composition vs plain Enter with the source popover
open and a highlighted row) proving the guard short-circuits before the
row-select branch, not just the onPlainEnter fall-through.

Co-authored-by: Orca <[email protected]>
@AmethystLiang

Copy link
Copy Markdown
Contributor

Thanks for the PR! PR approved and landing soon. Will be in the next release. Usually within 24 hours.

Can also get on the RC updates (press "shift" when click "check update") if you need it sooner :-)

@AmethystLiang
AmethystLiang merged commit 257b0b4 into stablyai:main Jul 20, 2026
1 check passed
@shinju4n
shinju4n deleted the fix/workspace-name-ime-composition branch July 20, 2026 08:31
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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]: Create-worktree name field duplicates the last Hangul syllable on Enter (missing isComposing guard)

2 participants