Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe mobile app now supports hardware keyboard commands through a local Expo module for Android and iOS. It adds platform-aware bindings, persisted terminal shortcut preferences, tab navigation, worktree navigation, session context tracking, and route integration. A hardware keyboard settings screen and menu entry were added. Worktree catalog requests now use the shared RPC settlement pipeline. Tests cover command translation, preferences, registries, navigation helpers, session context, and deferred worktree requests. Priority: ➖ Normal Merge Risk: 🔵 Low · up to Disconnecting a hardware keyboard may leave software-keyboard input unavailable on an active iOS surface. This is a bounded usability risk requiring owner awareness or follow-up. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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.
Actionable comments posted: 5
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: bb33aa44-f1b7-4516-845f-3d50d18a23eb
⛔ Files ignored due to path filters (1)
mobile/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (47)
mobile/app/_layout.tsxmobile/app/h/_layout.tsxmobile/app/hardware-keyboard-settings.tsxmobile/package.jsonmobile/packages/expo-hardware-keyboard-navigation/android/build.gradlemobile/packages/expo-hardware-keyboard-navigation/android/src/main/java/expo/modules/hardwarekeyboardnavigation/ExpoHardwareKeyboardNavigationModule.ktmobile/packages/expo-hardware-keyboard-navigation/android/src/main/java/expo/modules/hardwarekeyboardnavigation/HardwareKeyboardActivityLifecycleListener.ktmobile/packages/expo-hardware-keyboard-navigation/android/src/main/java/expo/modules/hardwarekeyboardnavigation/HardwareKeyboardNavigationPackage.ktmobile/packages/expo-hardware-keyboard-navigation/android/src/main/java/expo/modules/hardwarekeyboardnavigation/HardwareKeyboardNavigationRegistry.ktmobile/packages/expo-hardware-keyboard-navigation/android/src/main/java/expo/modules/hardwarekeyboardnavigation/HardwareKeyboardWindowCallback.ktmobile/packages/expo-hardware-keyboard-navigation/expo-module.config.jsonmobile/packages/expo-hardware-keyboard-navigation/ios/ExpoHardwareKeyboardNavigation.podspecmobile/packages/expo-hardware-keyboard-navigation/ios/ExpoHardwareKeyboardNavigationModule.swiftmobile/packages/expo-hardware-keyboard-navigation/package.jsonmobile/packages/expo-hardware-keyboard-navigation/src/index.tsmobile/src/cache/worktree-cache.tsmobile/src/hardware-keyboard/mobile-hardware-keyboard-actions.tsmobile/src/hardware-keyboard/mobile-hardware-keyboard-bindings.test.tsmobile/src/hardware-keyboard/mobile-hardware-keyboard-bindings.tsmobile/src/hardware-keyboard/mobile-hardware-keyboard-preferences.test.tsmobile/src/hardware-keyboard/mobile-hardware-keyboard-preferences.tsmobile/src/hardware-keyboard/mobile-hardware-keyboard-registry.test.tsmobile/src/hardware-keyboard/mobile-hardware-keyboard-registry.tsmobile/src/hardware-keyboard/mobile-session-hardware-keyboard-context.test.tsmobile/src/hardware-keyboard/mobile-session-hardware-keyboard-context.tsmobile/src/hardware-keyboard/mobile-tab-keyboard-navigation.test.tsmobile/src/hardware-keyboard/mobile-tab-keyboard-navigation.tsmobile/src/hardware-keyboard/mobile-worktree-keyboard-navigation.test.tsmobile/src/hardware-keyboard/mobile-worktree-keyboard-navigation.tsmobile/src/hardware-keyboard/mobile-worktree-keyboard-rpc-operations.tsmobile/src/hardware-keyboard/use-hardware-keyboard-text-input-focus.tsmobile/src/hardware-keyboard/use-mobile-hardware-keyboard-commands.tsmobile/src/hardware-keyboard/use-mobile-hardware-keyboard-preferences.tsmobile/src/hardware-keyboard/use-mobile-session-keyboard-navigation.tsmobile/src/hardware-keyboard/use-mobile-worktree-keyboard-navigation.test.tsmobile/src/hardware-keyboard/use-mobile-worktree-keyboard-navigation.tsmobile/src/hooks/use-active-worktree-scroll.tsmobile/src/host-screen/use-host-screen-controller.tsmobile/src/session/MobileNativeChatComposer.test.tsmobile/src/session/MobileNativeChatComposer.tsxmobile/src/session/MobileSessionCommandDock.tsxmobile/src/session/mobile-session-route-parity.test.tsmobile/src/session/use-mobile-session-controller.tsmobile/src/settings/mobile-settings-menu-items.tsmobile/src/terminal/terminal-live-input-affordance.test.tsmobile/src/transport/unvalidated-rpc-request-port-inventory.tsmobile/src/worktree/worktree-catalog-snapshot-client.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| const touchFocusFrameRef = useRef<number | null>(null) | ||
|
|
||
| useEffect(() => { | ||
| if (!enabled || !isHardwareKeyboardConnected()) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Description: Look for a hardware-keyboard connection-change subscription API.
fd -t f . mobile/packages/expo-hardware-keyboard-navigation --exec rg -n -C3 'isHardwareKeyboardConnected|addListener|Event|subscribe|onConnect' {}Repository: stablyai/orca
Length of output: 5230
🏁 Script executed:
#!/bin/bash
set -eu
hook=$(fd -t f 'use-hardware-keyboard-text-input-focus\.ts$' . | head -n 1)
printf '%s\n' "HOOK=$hook"
cat -n "$hook"
printf '\n-- native module files --\n'
fd -t f . mobile/packages/expo-hardware-keyboard-navigation --exec sh -c 'for f do case "$f" in *.ts|*.tsx|*.kt|*.swift) printf "\n### %s\n" "$f"; rg -n -C8 "isHardwareKeyboardConnected|onHardwareKeyboardCommand|addListener|OnStartObserving|Events\\(" "$f" || true;; esac; done' sh {}Repository: stablyai/orca
Length of output: 7965
Soft-input suppression does not react to a hardware keyboard disconnect.
isHardwareKeyboardConnected() is sampled only when the effect re-runs, and the deps are [enabled, inputRef, surfaceId]. If the user disconnects the keyboard while the same surface stays active, suppressSoftInput stays true and showSoftInputOnFocus stays false.
On Android handleTouchStart clears the state on the next tap. On iOS line 57 returns early, so the input stays focused with no software keyboard until enabled or surfaceId changes.
If the native module exposes a connection-change event, subscribe to it and re-evaluate the suppression state. Otherwise, allow the touch recovery path on iOS as well.
Run the following script to check for a connection-change API on the native module:
#!/bin/bash
# Description: Look for a hardware-keyboard connection-change subscription API.
fd -t f . mobile/packages/expo-hardware-keyboard-navigation --exec rg -n -C3 'isHardwareKeyboardConnected|addListener|Event|subscribe|onConnect' {}There was a problem hiding this comment.
Caution
This PR does not currently pass CI: two mobile test files fail (10 tests) and the changed-code quality gate reports 7 new type-assertion findings. One failure is a genuine behavior regression — WorktreeCatalogSnapshotClient.fetch can now return code: undefined where it previously fell back to 'request_failed'.
Reviewed changes
- Native Android module — new local Expo module that wraps the Activity
Window.Callbackand dispatches matchedKeyEvents through a process-wide command registry + weak observer set. - Native iOS module — installs
UIKeyCommands on the key window's root view controller via an added handler method and emitsonHardwareKeyboardCommandevents. - JS command layer —
buildMobileHardwareKeyboardCommandsmaps shared keybinding definitions to native commands (Mod→Ctrl on Android/Linux, Mod→Command on iOS; digit-index actions expand to 1–9), scoped by context and terminal policy with newest-scope-wins dedup. - Navigation hooks — worktree/tab cycle helpers,
MobileWorktreeNavigationHistory/MobileRecentTabOrder, the session-context registry, and host-layout wiring that publishes the sidebar-rendered worktree order. - Soft-keyboard suppression —
useHardwareKeyboardTextInputFocusshared by the terminal command dock and native chat composer. - Settings — new hardware-keyboard screen and settings-menu entry.
- Typed worktree catalog RPC —
worktree.psnow routes through anRpcOperation;getLastCachedWorktreesadded to the cache.
🚨 Existing WorktreeCatalogSnapshotClient tests fail — extra trailing argument
Routing worktree.ps through captureRpcOperationSettlement changed the call shape the test mock observes: rpc-operation.ts's request() always calls client.sendRequest(method, params, options), so a third undefined argument now reaches every mock. Six assertions in mobile/src/worktree/worktree-catalog-snapshot-client.test.ts still expect exactly two arguments, and that test file is not part of this PR's diff.
Technical details
# worktree-catalog-snapshot-client.test.ts assertions vs the RPC operation call shape
## Affected sites
- `mobile/src/worktree/worktree-catalog-snapshot-client.ts:77` — calls `captureRpcOperationSettlement(client, mobileWorktreeCatalog, params)`.
- `mobile/src/transport/rpc-operation.ts:105` — `request()` forwards `options` (undefined here) to `client.sendRequest`, adding a third argument.
- `mobile/src/worktree/worktree-catalog-snapshot-client.test.ts:122,136,154,168,185,209` — `toHaveBeenNthCalledWith(n, 'worktree.ps', {…})` now mismatches on the trailing `undefined`.
## Required outcome
- `cd mobile && pnpm test` is green. Either extend those assertions (trailing `undefined` or `expect.anything()`), or avoid passing an absent `options` through the operation.
## Open questions for the human
- Is the `captureRpcOperationSettlement` signature deliberately always forwarding `options` (so every strict mock must change), or should an omitted `options` stay omitted?⚠️ Changed-code quality gate fails on new type assertions
node config/scripts/check-changed-code-quality.mjs e9db164 fails with 7 typescript/consistent-type-assertions findings on added lines. The first (code quality) scan, type-aware scan and React Doctor scan are clean; only the casting scan fires. AGENTS.md requires every unavoidable cast to carry a line-specific SAFETY:-annotated disable, and the gate's own SAFETY: check confirms none of these have one.
Technical details
# typescript/consistent-type-assertions findings on added lines
## Affected sites
- `mobile/src/hardware-keyboard/mobile-hardware-keyboard-actions.ts:33` — `MOBILE_HARDWARE_KEYBOARD_ACTIONS as readonly string[]`
- `mobile/src/hardware-keyboard/use-mobile-worktree-keyboard-navigation.ts:157` — `getLastCachedWorktrees(hostId) as Worktree[] | null`
- `mobile/src/hardware-keyboard/use-mobile-worktree-keyboard-navigation.test.ts:11,71,72,73`
## Required outcome
- `pnpm run check:code-quality:changed` is clean. Prefer typed code (`MOBILE_HARDWARE_KEYBOARD_ACTIONS.some((action) => action === actionId)`, a typed cache accessor) where possible; otherwise add `// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: …` on each added line.ℹ️ Nitpicks
useHardwareKeyboardTextInputFocusreadsisHardwareKeyboardConnected()once per effect run, so connecting a physical keyboard after mount does not re-evaluate suppression untilsurfaceIdchanges.- Mobile ignores user keybinding overrides — both the settings list and the command builder call
getEffectiveKeybindingsForAction(actionId, platform)with no overrides argument, so desktop remaps do not reach the phone.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Important
The latest commit is clean, but the CI blockers from the previous review are still present at b200885: 10 mobile tests fail in 2 files and pnpm run check:code-quality:changed still reports 7 findings.
Reviewed changes
Incremental review of b200885 (refactor(mobile): keep terminal focus fixes out of navigation) on top of the prior review of 9e668ca.
- Soft-keyboard suppression reverted —
use-hardware-keyboard-text-input-focus.tsis deleted, and itsref/onTouchStart/showSoftInputOnFocuswiring is removed fromMobileNativeChatComposer.tsxandMobileSessionCommandDock.tsx(the live input goes back to bareshowSoftInputOnFocus). - Associated tests reverted —
MobileNativeChatComposer.test.tsandterminal-live-input-affordance.test.tsdrop the hardware-keyboard cases; both files pass again (23 tests) and no dangling references to the removed hook remain.
No new issues found in the delta. Current status of the previously reported findings (re-verified at this HEAD, not re-filed): mobile/src/session/mobile-session-route-parity.test.ts (3 tests) and mobile/src/worktree/worktree-catalog-snapshot-client.test.ts (7 tests) still fail, and the casting scan still flags mobile-hardware-keyboard-actions.ts:33, use-mobile-worktree-keyboard-navigation.ts:157, and use-mobile-worktree-keyboard-navigation.test.ts:11,71–73.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Incremental review of 15b2403 (fix(mobile): address navigation bot reviews) on top of the prior Pullfrog review of b200885. This delta resolves all six open threads from the previous review; no new issues found.
- Stale-route cancellation hardened —
useMobileWorktreeKeyboardNavigation's route generation now also keys onworktreeId, so a worktree change within the same host cancels an in-flight catalog response;h/_layout.tsxscopesupdateSidebarKeyboardWorktreesto the emitting host (emittedHostId === hostId); andWorktreeCatalogSnapshotClientrestores the non-empty-string'request_failed'code fallback. - Quality-gate fixes —
isMobileHardwareKeyboardActionIduses a.some()predicate instead of areadonly string[]cast, and the remaining implementation/test casts carrySAFETY:-annotatedoxlint-disable-next-linedirectives. - Parity + RPC test expectations regenerated —
mobile-session-route-parity.test.tsconstants andworktree-catalog-snapshot-client.test.tsassertions (thirdundefinedarg) were updated for the current source; both suites pass. - Preferences retry + effect timing — a failed keyboard-preferences load now clears
loadPromiseso a later mount retries, and the command handler ref updates inuseLayoutEffect.
Verified locally at 15b2403: 9 affected files / 33 tests pass, and node config/scripts/check-changed-code-quality.mjs e9db1642d1 reports 0 findings across every scan. The full mobile suite passes 4734 tests; the 14 files that error there fail only on missing *-webview-engine.generated build artifacts, unrelated to this PR.
ℹ️ Physical-device validation remains pending
The PR body still leaves "Physical-device validation for this split PR" unchecked. The navigation layer is unit-tested, but the Android Window.Callback interception and iOS UIKeyCommand installation are only exercised on real hardware. Flagging so the outstanding manual pass is a conscious decision rather than a missed checkbox.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
Adds hardware-keyboard navigation for the mobile worktree/session experience.
What Changed
Why
This is the focused navigation slice of the original #18195 implementation, so it can be reviewed and landed independently from iOS terminal input stability.
Linked Issue
Visual Proof
N/A — behavior is exercised through hardware-keyboard and navigation tests; physical-device evidence remains in the original implementation context.
Testing
ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run mobile/src/hardware-keyboard/use-mobile-worktree-keyboard-navigation.test.ts mobile/src/worktree/worktree-catalog-snapshot-client.test.ts mobile/src/session/mobile-session-route-parity.test.tsORCA_BACKGROUND_LAUNCH=1 pnpm tcnode config/scripts/check-changed-code-quality.mjs e9db1642d1Review focus
Agent skill upstream boundary
No upstream agent-skill changes are included.
Notes
Checklist