Repository navigation
Conversation
|
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: 📥 CommitsReviewing files that changed from the base of the PR and between 05ad0d467eb89cf7ef5eb7268fe5bba0ebcfb12d and 6ff9380. 📒 Files selected for processing (13)
🚧 Files skipped from review as they are similar to previous changes (13)
📝 WalkthroughWalkthroughTerminal live input now tracks native selection changes and synchronizes cursor movement with mirrored terminal text. New utilities handle UTF-16 and code-point offsets, caret inference, Hangul composition, emoji, and normalized input. Pending input flushing maintains cursor-aware mirror state and queues controls with optional field commits. Keypress, submit, and accessory handling use the queue-based flow, while the session screen adds connection-aware sending, tab reconciliation, recovery handling, attachment support, and expanded selection and deferred-send tests. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 (1)
mobile/src/terminal/use-terminal-live-accessory-input-commit.test.ts (1)
6-6: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueImport
TerminalLiveQueueControlOptionsfromterminal-live-control-payload.
TerminalLiveQueueControlOptionsis defined interminal-live-control-payload.ts;use-terminal-live-pending-input-flush.tsonly imports it, so using the hook module as the public import path adds an unnecessary coupling. Import the type where it is defined, matching the production source.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 55460670-ac5c-40f6-9c4e-77be4e923bdb
📒 Files selected for processing (13)
mobile/app/h/[hostId]/session/[worktreeId].tsxmobile/src/terminal/terminal-live-control-payload.tsmobile/src/terminal/terminal-live-selection-cursor.test.tsmobile/src/terminal/terminal-live-selection-cursor.tsmobile/src/terminal/terminal-live-selection-event-routing.test.tsmobile/src/terminal/terminal-live-selection-event-routing.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
bebc550 to
05ad0d4
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
mobile/app/h/[hostId]/session/[worktreeId].tsx (1)
3006-3033: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winResolved send failures still discard the typed command.
The catch only covers rejections. A resolved
{ ok: false }(orsend.accepted === false, which the live path checks viaisTerminalSendRpcAccepted) leavesinputcleared with no restore and no feedback.🐛 Restore on rejected sends too
- await client.sendRequest( + const response = await client.sendRequest( 'terminal.send', buildTerminalSendParams({ terminal: activeHandle, text, enter: true, deviceToken: deviceTokenRef.current }), TERMINAL_INPUT_SEND_OPTIONS ) + if (!isTerminalSendRpcAccepted(response)) { + setInput(text) + } } catch { setInput(text)
🧹 Nitpick comments (1)
mobile/app/h/[hostId]/session/[worktreeId].tsx (1)
3842-3850: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winInitial-prompt send skips
TERMINAL_INPUT_SEND_OPTIONS.Every other changed send path passes
failWhenDisconnectedso a queued send can't replay after reconnect; this one doesn't, so a prompt sent during a drop can execute long after the tab was created. Confirm this is intentional (e.g., tolerating the create→send window) rather than an omission.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5cc12b33-bdbd-4011-aa94-76a3bdd0a33a
📥 Commits
Reviewing files that changed from the base of the PR and between bebc550 and 05ad0d467eb89cf7ef5eb7268fe5bba0ebcfb12d.
📒 Files selected for processing (1)
mobile/app/h/[hostId]/session/[worktreeId].tsx
Greptile SummaryThis PR wires
Confidence Score: 5/5Safe to merge. The change is mobile-only and does not touch desktop, Electron, auth, filesystem, or IPC paths. The cursor-state machine, serialized control queue, and selection-event classifier are each small and pure, with comprehensive deterministic tests covering UTF-16 surrogate boundaries, Hangul composition, mid-field edits, hardware-arrow dedup, stale-handle rejection, and deferred-send ordering. The stale-handle guards (isHandleLive) and session-clear sequencing (clearPendingLiveInputCommitAndSelection called before awaiting the queued send) prevent the races that existed in the prior architecture. No correctness issues were found during review. Files Needing Attention: No files require special attention. Physical-device validation (noted in the PR) remains the one gap that deterministic tests cannot fully substitute for.
|
| Filename | Overview |
|---|---|
| mobile/src/terminal/terminal-live-selection-cursor.ts | New core module: UTF-16→code-point converters, planTerminalLiveSelectionMove, and planTerminalLiveFieldTextChange. Logic is sound — surrogate-pair clamping, Hangul flush-before-arrow, and single-payload middle-edit rewrite are all correct and covered by companion tests. |
| mobile/src/terminal/use-terminal-live-pending-input-flush.ts | Major refactor: adds ptyCursorCodePointRef, mirroredFieldTextRef, applyLiveInputSelection, and queueLiveInputControl. The mirror chain now carries both text diffs and control bytes, serializing them correctly. flushPendingLiveInputText extracts handle from the ref and narrows to non-null before passing to queuePayload — type-safe. |
| mobile/src/terminal/use-terminal-live-input-commit.ts | Adds handleLiveInputSelectionChange with correct one-shot paired/cursor-only classification; ArrowLeft/Right with non-empty field now return local-edit to prevent double-step; all clear/flush paths delegate to clearPendingLiveInputCommitAndSelection which also resets the selection session latch. |
| mobile/src/terminal/terminal-live-control-payload.ts | New helper: buildTerminalLiveFieldCommitPrefix (cursor-restore + held-flush) and buildTerminalLiveQueuedControlPayload (conditionally prepend prefix). Small, well-focused, correctly guarded by ownsFieldState. |
| mobile/src/terminal/terminal-live-selection-event-routing.ts | New routing module: classifies selection events as paired-with-text-change vs cursor-only, and decides whether to apply a cursor-only move. Simple, pure functions with full test coverage. |
| mobile/src/terminal/use-terminal-live-accessory-input-commit.ts | Refactored to use queueLiveInputControl instead of flushPendingLiveInputText + direct send. send-now and commit-held-then-send cases now queue atomically through the mirror chain and synchronously clear the session state. |
| mobile/src/terminal/terminal-live-text-commit.ts | Added ArrowLeft/Right guard: returns local-edit when field has text (either held or sent), preventing direct PTY sends that would duplicate the selection-driven arrow bytes. |
| mobile/app/h/[hostId]/session/[worktreeId].tsx | Minimal integration change: destructs and wires handleLiveInputSelectionChange to the TextInput's onSelectionChange prop. |
| mobile/src/terminal/use-terminal-live-input-commit.test.ts | Extensive new tests: trackpad cursor move, mid-field insert/delete, emoji code-point safety, Hangul composition with paired selections, hardware-arrow dedup, stale-handle rejection, submit reset, and deferred-send ordering. Covers all key event sequences documented in the PR. |
Reviews (2): Last reviewed commit: "fix(mobile): drop redundant live-input a..." | Re-trigger Greptile
ArrowLeft/Right with field text already resolve to local-edit via getTerminalLiveSpecialKeyDecision, and empty mirror state implies a zero PTY cursor so the extra ownsFieldState check was dead.
05ad0d4 to
6ff9380
Compare
|
Closing as part of fork PR backlog cleanup. This branch is long-conflicted (DIRTY) against current |
Summary
Screenshots
No visual change.
Testing
pnpm lint— not run through pnpm because the local minimum-release-age policy rejects two newly published lockfile entries; the installed mobile oxlint binary passed instead.pnpm typecheck— not run through pnpm for the same policy reason;mobile/node_modules/.bin/tsc --noEmitpassed.pnpm test— not run through pnpm for the same policy reason;mobile/node_modules/.bin/vitest runpassed 317 files, 2,337 tests, with 2 skipped.pnpm build— not run; this checkout has no generated native iOS project and no physical iOS device was online.Additional checks:
mobile/node_modules/.bin/oxlintmobile/node_modules/.bin/oxfmt --check .(949 files)node config/scripts/check-max-lines-ratchet.mjsgit diff HEAD^..HEAD --checkAI Review Report
Claude reviewed the exact change read-only in three gates: pure selection/control logic, React hook and queue integration, then the combined 13-file commit. All three gates ended with
NO ACTIONABLE FINDINGS. The review traced UTF-16/code-point boundaries, collapsed versus ranged selection, middle rewrite ordering, Hangul held-syllable behavior, hardware/accessory controls, stale handles, deferred sends, React Native event ordering, and Android shared-path behavior. An earlier queue/state-clear race was identified during implementation and fixed before these final gates by serializing controls on the mirror chain and clearing the prior field session synchronously.Cross-platform review confirmed this mobile-only change does not touch desktop shortcuts, labels, filesystem paths, shell spawning, or Electron behavior. The shared React Native path and Android selection-event ordering were reviewed; no actionable Android regression was found.
Security Audit
No dependencies, auth, secrets, filesystem paths, shell commands, native modules, or IPC schemas are added. Terminal output remains limited to normalized field text and existing mapped control bytes. Active-handle and terminal-tab guards reject stale selection/control sends, and all sends use the existing serialized terminal input channel. No security follow-up was identified.
Notes
ELI5
On iOS, moving the cursor with the keyboard trackpad (or by selecting text) now moves the real terminal cursor too. Insertions and deletions stay in the right place, and Hangul composition is not broken. Hardware arrow keys and trackpad moves no longer send the same key twice.