Repository navigation
Conversation
Greptile SummaryThe PR gives the browser exclusive ownership of provisional IME text while React retains ownership of settled drafts. It also coordinates deferred attachment insertion with the same pane-scoped composition owner.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/native-chat/NativeChatComposer.tsx | Shares one IME owner across keyboard, field, and attachment paths and keys pane-owned composer state by paneKey. |
| src/renderer/src/components/native-chat/NativeChatComposerField.tsx | Converts the textarea to browser-owned provisional state and settles composition once through composition-end or blur. |
| src/renderer/src/components/native-chat/use-native-chat-composer-attachments.ts | Queues resolved paths during composition, bounds the queue, discards it when disabled, and flushes without restoring focus. |
| src/renderer/src/components/native-chat/use-native-chat-external-attachments.ts | Prevents new or asynchronously completed external attachments from being delivered while the composer is disabled. |
| src/renderer/src/components/native-chat/native-chat-composer-composition.test.tsx | Covers stale rerenders, idle synchronization, deletion, Enter ownership, blur fallback, and both settlement event orders. |
Sequence Diagram
sequenceDiagram
participant U as User/IME
participant F as Composer field
participant O as Shared IME owner
participant A as Attachment hook
participant R as React draft
U->>F: compositionstart
F->>O: setComposing(true)
U->>F: Update provisional DOM text
A->>O: isComposing()
O-->>A: true
A->>A: Queue resolved paths
U->>F: compositionend or blur
F->>O: Release composition ownership
F->>R: Adopt settled DOM value
F->>A: Flush queued paths
A->>R: Apply attachment references once
Reviews (8): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughNative chat now shares IME ownership across the uncontrolled textarea, keyboard handling, and attachment handling. Draft synchronization pauses during composition and reports the browser value when composition settles or focus is lost. Pending attachment paths queue during composition and flush after draft adoption. Disabled transitions clear attachment queues and block new insertion. The composer remounts when pane ownership changes. Tests cover composition, settlement ordering, Enter handling, attachment ordering, disabled states, pane remounting, and autogrow integration. Merge Risk: ⚪ Minimal · up to The change keeps provisional IME text intact while streaming and attachments resolve, then applies the settled draft and attachments exactly once; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 9 files. (1 skipped: 1 unsupported.) Full details: Description checkExplanation The description is complete and directly addresses the change, root cause, linked issue, visual proof, testing, AI disclosure, platform considerations, and checklist items. It provides detailed validation evidence and states the remaining native CJK verification gaps.
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 |
…tive-chat-ime-streaming
|
Fresh CI on head |
Reviewed — merging, with two follow-ups filedThe fix was verified in a real engine, not just happy-dom, which matters because happy-dom does not model Blink's textarea dirty-value flag and that flag is the entire mechanism here. Driving a real Chromium textarea over CDP with
Also confirmed React 19 writes 14 of 16 mutations killed, one equivalent, one real gap. Two corrections to the PR's claims"Zero proven P0/P1/P2 findings" does not survive. There is a P2 with a runnable repro — filed as #17359. The structured send clears the draft asynchronously, so a clear landing during a composition is silently dropped and Not blocking: on "Never focus from the deferred flush" has no working test. On size — one coherent change, correctly not split660 lines, but ~120 are production and ~540 are tests, and the three parts are causally chained rather than bundled:
Only the On the latched flag
But this PR escalates its blast radius: a stuck Two smaller things, not blocking
Where this runsNo CI job anywhere exercises a real IME against this composer. The PR gate is ubuntu-only (plus |
…lyai#17169) * fix(native-chat): preserve IME composition during streaming * fix(native-chat): remount composer when draft owner changes * fix(native-chat): reset composition across draft owners * fix(native-chat): key pane-owned composer state * fix(native-chat): preserve resolved attachments through IME * fix(native-chat): bound deferred attachment paths * fix(native-chat): add pending attachment overflow translation * test(native-chat): publish attachment probe after render * fix(native-chat): repair localization file newline * fix(native-chat): use effect for attachment probe publication
ELI5
While someone is composing Hangul or CJK text, the browser temporarily owns characters that React has not received yet. Orca now leaves that provisional text alone—even while a response streams or an attachment finishes uploading—and applies the settled draft and attachment exactly once afterward.
Root cause
The composer previously had two competing authorities during IME composition:
When an attachment resolved during composition, React could render the application draft while the browser still held a newer preedit. Settlement then re-adopted stale DOM and erased the attachment. Whole-draft reconciliation could not determine which side was semantically newer.
The ownership boundary is now explicit: the browser exclusively owns provisional composition DOM. React owns only settled drafts, while asynchronously resolved attachment paths wait at their semantic sink.
What changed
useImeEnterGestureOwnership()instance for the field, keyboard handler, and attachment path.compositionend → blurandblur → compositionendorders exactly once.Linked issue
Fixes #16911
Shared acceptance checklist: #17172.
Visible Electron proof
Exact app identity, worktree, and branch were checked before exercising the real Codex Chat composer in a fresh Electron profile.
出力中の変換remained unchanged.出力中の変換確定exactly once.document.activeElementremainedBODY, proving the deferred attachment flush did not steal focus.Electron/DOM proof validates Orca's ownership contract. It does not claim observation of an operating-system candidate window.
Exact-head verification
Published head:
5eeda87c29cc4231cd3512f7c887ad81290906c4pnpm install --frozen-lockfile: passed locally.pnpm tc: passed.pnpm tc:web: passed.pnpm run check:code-quality:changed: zero findings.33293924982completed cleanly: 18 successful, 8 skipped, 0 failed or pending (includingverify). Prior failures were the happy-dom OffscreenCanvas environment regression, not Native Chat assertions.Skipped checks are the non-applicable Git compatibility, xterm patch sync, shell contracts, native-cache preparation, browser-provider, cross-version wire, managed-hooks Node 18, and e2e jobs. macOS and Windows package jobs passed.
Native-host evidence
m4airlivepnpm tc:webpassed; worktree clean.unverifiablebecause the selected input source is ABC.awinlivenode-ptytoolchain, so native candidate-window behavior isunverifiable.openclawlivepnpm tc:webpassed.unverifiablebecause the SSH host is headless.No host is classified as exited merely because graphical native evidence is unavailable.
Readiness review
Exact-head readiness review found zero proven P0/P1/P2 issues; counsel was not required because there were no candidate findings.
Code elegance
Independent root-cause/elegance audits found zero P0/P1/P2 findings and no materially simpler correct implementation.
AI disclosure
AI-assisted implementation, test construction, and review were used. Claims above are tied to deterministic tests, rendered inspection, exact-head host runs, or explicitly named residual gaps.
Agent skill upstream boundary
Checklist