Repository navigation
Fix mobile terminal Korean typing left invisible by the IME deferral model - #7181
realitsyourman wants to merge 6 commits into
Conversation
|
Warning Review limit reached
Next review available in: 12 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between b69ebda99addc4068bdcf0e7dcb315e24e3a83d7 and 137978e. 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR replaces the previous pending-text/scheduled-commit model for terminal live input mirroring with a held-text/sent-text mirror model. It adds a new Hangul mirror computation utility ( Related PRs: None identified from the provided information. Suggested labels: area/terminal, mobile Suggested reviewers: Reviewers familiar with the mobile terminal live-input subsystem should review this change given its high complexity in core commit/mirror hooks. 🐰 A syllable held, then let it go, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
mobile/src/terminal/use-terminal-live-pending-input-flush.ts (1)
124-124: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
useEffectEventhere instead of writing the callback ref during render.
runMirrorStepRef.current = runMirrorStepmutates a ref in the render path. Since this hook is already on React 19.2+,useEffectEventis the cleaner way to keep the timeout callback on the latestrunMirrorStepwithout a render-time mutation.mobile/src/terminal/terminal-live-text-commit.ts (1)
69-82: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winConfirm intent: accessory Delete is fully swallowed (no PTY bytes) whenever any text is held/sent.
getTerminalLiveAccessoryLocalEditText'sdeletebranch returnsfieldTextunchanged, so when routed through the accessory hook'slocal-edithandling,applyLiveInputMirrorcomputes a zero-length diff and nothing is sent to the PTY at all. This is documented as intentional (forward-delete has nothing "after" cursor in this field's own model), but the real shell's cursor position is independent of this hidden field (e.g., after arrow-key navigation), so a forward-delete could legitimately need to reach the PTY even during active composition. There's also no test exercisinglocalEdit: 'delete'combined with non-emptyheldText/sentText.Worth confirming this is the desired behavior (vs. forwarding the raw delete byte), and adding a regression test either way.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7943bbaf-3b6c-486a-9faa-615a14db0e8c
📥 Commits
Reviewing files that changed from the base of the PR and between 0ea354d and b69ebda99addc4068bdcf0e7dcb315e24e3a83d7.
📒 Files selected for processing (11)
mobile/src/terminal/terminal-live-hangul-mirror.test.tsmobile/src/terminal/terminal-live-hangul-mirror.tsmobile/src/terminal/terminal-live-pending-flush-state.test.tsmobile/src/terminal/terminal-live-pending-flush-state.tsmobile/src/terminal/terminal-live-text-commit.test.tsmobile/src/terminal/terminal-live-text-commit.tsmobile/src/terminal/use-terminal-live-accessory-input-commit.test.tsmobile/src/terminal/use-terminal-live-accessory-input-commit.tsmobile/src/terminal/use-terminal-live-input-commit.test.tsmobile/src/terminal/use-terminal-live-input-commit.tsmobile/src/terminal/use-terminal-live-pending-input-flush.ts
|
Device QA update — verified on a physical Galaxy Z Fold7 (SM-F966N) with Samsung Keyboard Korean IME, running the release APK built from this branch (
Author reports overall Korean typing now works correctly on device. Checklist items for Enter ordering, Backspace sync, dictation/paste, tab-switch, non-Hangul IME, and SSH remain to be ticked individually. Screenshot will be attached in the conversation. |
탭 상태 지연으로 활성 탭 타입이 일시적으로 null이 될 때 runMirrorStep의 stale-handle 가드가 조합 중 음절을 버리지 않도록 pending-clear 효과와 동일한 null 허용 패턴 적용. 테스트 하네스가 ref와 prop을 동일 소스에서 파생하도록 결합해 실제 경로의 lag 프레임을 검증. queueTerminalLiveMirrorSend의 previousSend await를 catch로 보호.
… the mirror model The mirror model migrated all live-input sends to queueTerminalLiveMirrorSend, leaving queueTerminalLivePendingFlush referenced only by its own tests. Remove the dead function and its three tests. Co-authored-by: Orca <[email protected]>
b69ebda to
137978e
Compare
Maintainer takeover — reviewed, trimmed, rebased, verifiedI've taken ownership of this PR, audited it line-by-line (with extra scrutiny given the large diff), trimmed dead code, rebased onto latest DescriptionThe regression is real and severe. Confirmed directly in the #7011 base code: The fix (kept): replace the indefinite deferral with a mirror model ( Scope verdict — the diff is justified. The headline number looks alarming, but the production surface is a net-neutral swap, not additive bloat:
Every one of the 11 files is under What I changed on takeover:
EvidenceRED (regression reproduced on the real #7011 base code): materialized the base GREEN (fix + hardening): the hook-level suite drives the exact issue scenarios and asserts the sent-byte sequences:
Commands (all clean, post-rebase):
Per the OOM guard I did not run a full repo typecheck; I verified integration by interface analysis (option + return field sets unchanged) instead. ELI5Your phone keyboard builds a Korean letter one piece at a time (ㅎ → 하 → 한). The old code was scared of showing half-built letters, so it hid everything until you pressed Enter — which meant you couldn't see what you were typing at all, and pressing Space never helped. The new code is smarter: it shows every letter that's already finished right away, and only holds the one letter you're still building for a heartbeat (300 ms) before showing it too. If it guesses wrong, it quietly backspaces and fixes it. So Korean now appears as you type, just like English. Trade-offs / limitations
Head after takeover: |
|
Closing this as superseded by #7273, which has now been merged. #7273 carries forward the Korean IME mirror-model fix from this PR, preserves the device-verified behavior for #7183, and adds the missing live-input keyboard affordance/refocus fix we found during follow-up testing:
Thanks for the original Korean IME work here; it is included in the merged PR. |
Summary
delayMs: null, no settle timer) inside an invisible 1×1 capture field, so nothing reached the PTY while typing and Space never flushed.\x7f(DEL) corrections.terminal.sendacceptance gating for control bytes (\ris still suppressed if the text send is not accepted).undefined/nullactive tab type (mobile tab-list lagging the desktop) no longer wipes in-progress composition; explicit non-terminal tab types still clear.Closes #7183. Follow-up to #7011 (fixes the regression it introduced). ASCII typing remains immediate and unchanged.
Screenshots
Testing
pnpm lint— mobile-scopedpnpm --dir mobile lint(oxlint) passed for this mobile-only PR; root not run.pnpm typecheck— mobile-scopedpnpm --dir mobile exec tsc --noEmitpassed (also proves the session route compiles unchanged — this PR does not touch it).pnpm test— mobile-scopedpnpm --dir mobile testpassed: 165 files, 1206 passed, 2 skipped.pnpm build— not run; mobile build requires platform build credentials/devices not available in this environment.간→가나resplit, timer-commit + DEL correction, Space/ASCII commit, delete-all, non-Hangul IME passthrough), never-skip send chain (runs after failed/throwing predecessor, state reset race), hook-level sent-byte sequences (['하','\x7f','한'],['한','\r'],['한 '], acceptance-rejection suppressing\r, unmount timer cleanup), and a re-rendering harness proving a transientundefinedtab type preserves composition while'chat'still clears (real RED/GREEN evidence for both).Manual device QA checklist (requires a physical Android device with Samsung Keyboard/Gboard Korean IME; not runnable in this environment)
한글shows the leading syllable live in the terminal; the trailing syllable appears within ≤300 ms — verified on device (see QA comment)ㅎ/ㅏnever remain in the terminal — verified on device한글commits immediately together with the space — verified on device (multi-word sentence)한글abcechoes live correctlyAI Review Report
onChangeText(mirror state is zeroed before the native clear, so a trailing empty change is a no-op), dictation/paste desync (external sends fully flush + reset the field session first), and preservation of all non-Korean flows (ASCII fast path, special keys on an empty field, Backspace/Delete as local edits so the mirror diff emits the erase without double-erasing).null= unknown, not "left the terminal"; genuine departures remain caught by the handle clauses), the test harness now couples the tab-type ref to the prop so the lag scenario is genuinely exercised, and the send chain's internal await is defensively caught so a future raw rejecting promise cannot silently skip a delta.mobile/src/terminal/*— no desktop shortcuts, shortcut labels, file paths, shell behavior, or Electron accelerators change. The desktop session route is untouched (verified by an emptygit diffagainstmainfor that file and a clean typecheck).terminal.sendtext relying on standard PTY echo (no local-echo assumption); the RPC method, payload shape, and acceptance semantics are unchanged, so local and SSH runtimes behave identically.\rstays acceptance-gated, so a desynced line is never silently submitted); Japanese/Chinese IME now mirrors live with corrections instead of the previous 150 ms quiet settle.Security Audit
package.json/lockfiles untouched.terminal.sendRPC method and payload shape unchanged; the byte-limit guard (isTerminalLiveInputWithinByteLimit) and thesend.accepted === trueacceptance check are preserved. Mirror payloads consist only of user keystrokes plus\x7ferase bytes.Notes
onChangeTexttiming, DEL handling by specific shells/TUIs) is not reachable from the vitest harness — the manual QA checklist above should be run on a physical Galaxy device before release.queueTerminalLivePendingFlushinterminal-live-pending-flush-state.tsis now unreferenced by production code (the hooks migrated to the never-skip chain). Left in place per repo guidance against removing pre-existing code beyond the change's scope; can be removed in a follow-up if maintainers prefer.