Repository navigation
Conversation
|
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
Walkthrough
Merge Risk:
|
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 18 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
-
Check name Status Explanation Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. Title check ✅ Passed The title clearly and concisely describes the main change: an Android opt-in to resize the terminal for the keyboard. Description check ✅ Passed The description covers the required sections and gives detailed change, rationale, testing, and compatibility information. It does not include the required visual attachment, but it explains this gap …
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 216e1e98-901c-4c42-9ef8-be565c231b27
📥 Commits
Reviewing files that changed from the base of the PR and between 27b823f and c8db8e387354ff8cf1987ae98ad847865e6be7bd.
📒 Files selected for processing (18)
docs/site/content/docs/mobile.mdxmobile/app/terminal-settings.tsxmobile/src/session/MobileSessionActiveContent.tsxmobile/src/session/MobileSessionCommandDock.tsxmobile/src/session/MobileSessionContentRow.tsxmobile/src/session/mobile-session-route-parity.test.tsmobile/src/session/mobile-session-terminal-toast-lift.test.tsxmobile/src/session/use-mobile-session-keyboard-state.test.tsxmobile/src/session/use-mobile-session-keyboard-state.tsmobile/src/session/use-mobile-session-preference-focus.tsmobile/src/session/use-mobile-session-presentation.tsmobile/src/session/use-mobile-session-screen-state.tsmobile/src/storage/preferences.test.tsmobile/src/storage/preferences.tsmobile/src/terminal/TerminalKeyboardResizeSetting.tsxmobile/src/terminal/terminal-viewport-refit-state.tsmobile/src/terminal/terminal-viewport-refit.test.tsmobile/src/terminal/terminal-viewport-refit.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — read the full 18-file diff, verified the Android opt-in against the surrounding session/refit code, and ran the touched mobile tests (mobile-session-terminal-toast-lift, terminal-viewport-refit, preferences, mobile-session-route-parity, use-mobile-session-keyboard-state, mobile-session-terminal-frame-layout, terminal-live-input-affordance, agent-send-keyboard-dismissal-wiring) plus mobile tsc --noEmit — all green. The default (setting off) path stays behind !resizeForKeyboard / the existing ternaries, so upstream keyboard behavior is unchanged.
- Setting + storage — new per-device
orca:terminalKeyboardResizeEnabledpreference, with a switch row rendered only on Android and the sameuserToggledReflate-read guard the autocomplete row uses. - Dock/frame layout — with the option on, the dock grows
paddingBottomby the keyboard height instead of translating, so the terminal frame shrinks and the shared PTY is refit through the existingterminal.updateViewportpath; the off path keeps the translate. - Refit reducer —
reduceTerminalFrameHeightRefitand the height-only window-resize effect take aresizeForKeyboardflag (defaultfalse), so the deferred-refit behavior is preserved when the option is off. - Terminal toast — the terminal frame's toast gets its own lift (0 while the dock is visible, full lift under native chat) instead of reusing the shared
toastAnimatedStyle, and the markdown/file/browser toasts keep the full lift.
ℹ️ Desktop display mode is a silent no-op with the option on
The author already calls this out as a limitation of the opt-in: when the desktop holds the terminal size, updateMobileViewport answers applied: false, so the phone frame still shrinks while the PTY keeps its rows, and activeTerminalKeyboardLift is forced to 0. In that mode the user sees fewer rows with no cursor correction until the keyboard closes. No change requested — flagging only so the behavior is a conscious decision for an off-by-default, Android-only switch.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — reviewed the delta since the prior pullfrog review (c8db8e3). The only change is a one-line commit adding an explicit screen-reader label to the keyboard-resize switch.
- Screen-reader label on the keyboard-resize switch — the
Switchinmobile/src/terminal/TerminalKeyboardResizeSetting.tsxnow carriesaccessibilityLabel="Resize terminal for keyboard", matching its row label. No other file changed since the prior review.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
4d2fac3 to
e008f38
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Serialize the resize preference write before the… · use-mobile-session-preference-focus.ts:49-63
mobile/src/session/use-mobile-session-preference-focus.ts:49-63
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winSerialize the resize preference write before the session reload.
When the user toggles the switch and presses Back before
AsyncStorage.setItemresolves, the settings write and the session focus hook'sgetItemcan overlap. The focus hook can therefore apply the old value toterminalKeyboardResizeEnabled. The session can use the wrong keyboard mode until a later focus event reloads the preference.Make the loader wait for the pending resize-preference write.
Suggested fix
const TERMINAL_KEYBOARD_RESIZE_KEY = 'orca:terminalKeyboardResizeEnabled' +let terminalKeyboardResizeWrite: Promise<void> = Promise.resolve() export async function loadTerminalKeyboardResizeEnabled(): Promise<boolean> { try { + await terminalKeyboardResizeWrite const raw = await AsyncStorage.getItem(TERMINAL_KEYBOARD_RESIZE_KEY) return raw === 'true' } catch { return false } } -export async function saveTerminalKeyboardResizeEnabled(enabled: boolean): Promise<void> { - await AsyncStorage.setItem(TERMINAL_KEYBOARD_RESIZE_KEY, String(enabled)) +export function saveTerminalKeyboardResizeEnabled(enabled: boolean): Promise<void> { + const write = terminalKeyboardResizeWrite.then(() => + AsyncStorage.setItem(TERMINAL_KEYBOARD_RESIZE_KEY, String(enabled)) + ) + terminalKeyboardResizeWrite = write.catch(() => {}) + return write }
🟡 Minor · Reschedule the refit when keyboard resizing becomes enabled. · terminal-viewport-refit.ts:93-97
mobile/src/terminal/terminal-viewport-refit.ts:93-97
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winReschedule the refit when keyboard resizing becomes enabled.
When focus reload changes
resizeForKeyboardfromfalsetotrue, an existing timer still uses the old callback. If the keyboard becomes visible before that timer fires, the callback passesfalsetoreduceTerminalFrameHeightRefit, which marks the refit pending and returns without refitting.The notification effect runs again after the option changes, but it reports the same keyboard visibility. The reducer treats that event as a no-op. No later refit is guaranteed until another height event or keyboard close.
Suggested fix
const scheduleForcedViewportRefit = useCallback(() => { forceNextRefitRef.current = true scheduleViewportRefit() }, [scheduleViewportRefit]) + const previousResizeForKeyboardRef = useRef(resizeForKeyboard) + useEffect(() => { + const previous = previousResizeForKeyboardRef.current + previousResizeForKeyboardRef.current = resizeForKeyboard + if ( + previous || + !resizeForKeyboard || + !frameHeightRefitStateRef.current.keyboardVisible + ) { + return + } + viewportMeasuredRef.current = false + scheduleViewportRefit({ heightOriginated: true }) + }, [resizeForKeyboard, viewportMeasuredRef, scheduleViewportRefit]) + // Why: the tab strip toggles at the 1↔2 terminal boundary (~40px area change), so the cached viewport goes stale.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 01f6d04b-889f-4207-a962-3a299198aef6
📥 Commits
Reviewing files that changed from the base of the PR and between 4d2fac357e60ea08653b1511eea5c5a6b2583a31 and e008f38b0b3db28852b4cf553be105c28c26be5f.
📒 Files selected for processing (2)
mobile/src/session/MobileSessionActiveContent.tsxmobile/src/session/mobile-session-route-parity.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
F1 — Serialize the resize preference write (declined, with evidence) On Android every F2 — Reschedule the refit when Implemented in |
e008f38 to
d1a2941
Compare
There was a problem hiding this comment.
ℹ️ No critical issues — the delta since the last review is a clean fix; one minor test-coverage suggestion inline.
Reviewed changes — reviewed the two new commits (f0cf0ca, d1a2941) against the full 19-file diff, focusing on what changed since the prior pullfrog review. The feature itself is unchanged; the new commits reconcile it with main and address the F2 review finding.
hostOs()migration — the PR's new host checks interminal-settings.tsxanduse-mobile-session-preference-focus.tsnow readhostOs()instead ofPlatform.OS, matching upstream's #23110 migration so the host-OS census stays green.- Optional-chained
terminalFrameRef—use-mobile-session-presentation.tsreadsterminalFrameRef?.current?.height ?? 0, letting presentation hook tests run without the frame ref. - New
resizeForKeyboardtoggle effect — aprevResizeForKeyboardRefeffect reschedules a plainscheduleViewportRefit()when the option flips while the keyboard is visible, so a height-only change suppressed under the old value is resent. This addresses CodeRabbit's F2 finding; the plain (non-height-originated) path is correct here because the option is on and the frame already sits at its new height at fire time. - Route-parity pins re-measured — hooks 284, callbacks 81, runtime strings 532, each with a comment explaining the move.
ℹ️ Nitpicks
- The new
prevResizeForKeyboardRefeffect is the whole F2 fix, but nothing exercises it — the window-resize test slices fromprevWindowDimsRefand stops before this block. See the inline note for a small case that would pin it.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
d1a2941 to
9de28ae
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — reviewed the delta since the last pullfrog review (d1a2941), which is a rebase on main 21f8e0f9db plus a test-only change in terminal-viewport-refit.test.ts. The feature code is unchanged; the new test resolves the prior coverage nitpick on the F2 toggle effect. pnpm exec vitest run src/terminal/terminal-viewport-refit.test.ts passes (22/22).
- Mid-keyboard toggle test — adds
resends the deferred resize when the option toggles mid-keyboard, asserting theprevResizeForKeyboardRefeffect'skeyboardVisibleguard,viewportMeasuredRefreset,scheduleViewportRefit()call and dep array, and would fail if the effect were removed. - Window-effect assertion loosened — the height-only window-resize test now checks
!resizeForKeyboardandframeHeightRefitStateRef.current.keyboardVisibleseparately instead of one compound string, so it tracks the reformatted guard interminal-viewport-refit.ts.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Add a "Resize terminal for keyboard" switch to Settings -> Terminal on Android, off by default. When it is on and the soft keyboard opens, the command dock pads by the keyboard height instead of translating over the terminal, so the terminal frame shrinks, and frame-height changes refit the PTY rows through the existing terminal.updateViewport path instead of waiting for the keyboard to close. Closing the keyboard grows the frame and refits the rows back. With the switch off, nothing changes: the dock still translates and height refits stay deferred while the keyboard is visible. The terminal frame's toast now takes its own lift. With the switch on the dock already raises the frame's bottom above the keyboard, so the shared toast style lifted it a second time; markdown, file and browser frames have no dock and keep the full lift. Native chat hides the dock, so its terminal toast keeps the full lift too. Constraint: default behavior must not resize the PTY on keyboard toggles Rejected: a separate resize RPC | terminal.updateViewport already refits in place Tested: mobile pnpm test, tsc --noEmit, check:tests-typecheck Tested: Android emulator (API 33) with the mock server: 54x45 -> 54x25 on keyboard open, back to 54x45 on close; nothing sent with the switch off Not-tested: physical device, desktop display mode, the terminal toast on screen
The row title is a sibling of the Switch, so TalkBack announced the switch without a name.
9de28ae to
cd8ab75
Compare
|
Comments Outside DiffThese findings could not be posted inline.
|
There was a problem hiding this comment.
ℹ️ No critical issues — the delta since the last review is a rebase; one coverage note below.
Reviewed changes — reviewed the 17-file PR at cd8ab75e5b (base 31012aeb09) against the prior pullfrog review at 9de28aedf0. Production code is unchanged from the previously approved revision; the delta is the rebase onto 31012aeb09 plus upstream's #23815 test cleanup.
- Rebased onto
main31012aeb09(487216d453,cd8ab75e5b); both conflicts resolved by takingmain's side. - Dropped the tests upstream deleted —
mobile-session-route-parity.test.tsis gone, and the hook-source assertions were stripped fromterminal-viewport-refit.test.ts. - Added the new required option field to a surviving harness —
terminal-cell-box-refit.test.tsxnow passesresizeForKeyboard: false.
ℹ️ The reducer's resizeForKeyboard branch lost its only test
The feature's core promise — with the option on, keyboard-driven frame-height changes refit the PTY instead of waiting for the keyboard to close — lives in the resizeForKeyboard branches of reduceTerminalFrameHeightRefit and in the prevResizeForKeyboardRef effect. The rebase kept both, but upstream #23815 removed every test that touched them: the reducer tests that survive exercise only the default false path, and the hook-source test for the toggle effect was deleted as source-text junk. A regression here would now be silent.
Technical details
# Restore behavior-level coverage for the keyboard-resize opt-in
## Affected sites
- `mobile/src/terminal/terminal-viewport-refit-state.ts:51,73` — `state.keyboardVisible && !resizeForKeyboard` guards; only the `false` path is exercised.
- `mobile/src/terminal/terminal-viewport-refit.ts:226-237` — the `prevResizeForKeyboardRef` effect; its source-text test was deleted upstream.
- `mobile/src/terminal/terminal-viewport-refit.test.ts` — the remaining reducer tests never pass `resizeForKeyboard`.
## Required outcome
- A behavior-level test that fails if the `resizeForKeyboard` branch regresses: drive `reduceTerminalFrameHeightRefit` with `keyboardVisible: true` and a height change while passing `resizeForKeyboard = true`, and assert `shouldRefit` is true. Reducer tests of this shape survived upstream's cleanup, unlike the source-text assertions.
## Open questions for the human (optional)
- The `prevResizeForKeyboardRef` effect fires on either direction (`was !== resizeForKeyboard`), so a true→false toggle with the keyboard visible would reschedule a plain refit and reflow the PTY to full height mid-keyboard, against the off-path guarantee. In practice the only control lives on a separate Settings screen, where the IME is dismissed, so this may be unreachable — worth confirming whether the guard should be narrowed to the off→on transition.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
호스트가 PTY 크기를 조절하지 않는 desktop 표시 모드에서도 도킹 패딩과 커서 리프트 비활성화가 그대로 적용되어, 프레임이 줄어든 채 PTY 행 수가 유지되어 상하단 행이 잘려 보였다. 표시 모드가 phone/auto일 때만 리사이즈 동작을 적용해 데스크톱 보유 상태에서는 기존 슬라이드 동작을 유지한다.
AsyncStorage 쓰기가 거절되면 스위치는 새 값을 표시한 채로 남고 세션은 돌아왔을 때 이전 값을 다시 읽어 실제 동작과 표시가 어긋났다. 저장 실패 시 저장된 값을 다시 읽어 스위치를 실제 상태와 일치시킨다.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — reviewed the two commits since the last pullfrog review (cd8ab75e5b) against the full 17-file diff. The delta is a behavior fix plus a defensive storage fix; no inline findings.
- Gated the resize layout on display mode — the dock now only grows its
paddingBottom(and the terminal frame only drops its cursor-anchored lift) whenisTerminalPhoneDisplayMode(activeHandle, terminalModes)is true. In an explicitdesktopmode the dock keeps the upstreamtranslateYand the frame no longer shrinks a PTY the host won't resize. - Recovered the settings switch from a refused write —
TerminalKeyboardResizeSetting.togglenow re-reads the stored value whensaveTerminalKeyboardResizeEnabledrejects, so the switch can't claim a value the session won't load on return. - Extended the toast-lift tests — the harness takes a
displayMode, and two cases pin the desktop (lift stays) and explicit-phone (lift zeroes) branches of the new gate.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
저장 실패 시 재조회는 사용자가 계속 토글하는 사이에도 실행되어, 거절된 쓰기의 읽기가 더 최근 토글의 선택을 덮어쓸 수 있었다. 토글마다 시퀀스를 부여해 가장 최근 토글의 재조회만 스위치에 반영한다.
upstream stablyai#23815 정리로 resizeForKeyboard=true 경로를 검증하던 테스트가 사라져, 옵션의 핵심 분기(키보드 표시 중 프레임 높이 변화 시 즉시 refit)가 무검증 상태였다. 리듀서를 true로 구동해 지연 없이 refit하고 디바운스 커밋도 재지연하지 않음을 고정한다.
|
On the On pullfrog's open question — whether the |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — reviewed the two commits since the last pullfrog review (5c20140e0f) against the full 19-file diff. The delta is a client-side race fix plus a restored behavior-level test; no inline findings. terminal-keyboard-resize-setting.test.tsx (2) and terminal-viewport-refit.test.ts (6) pass, and mobile tsc --noEmit passes.
- Guarded the settings switch against a stale read-back —
TerminalKeyboardResizeSettingnow tracks atoggleSeqRef, and a refused save's storage read-back applies only while its own toggle is still the latest. An older failure can no longer overwrite a newer choice. - Pinned the interleaving in a new component test —
terminal-keyboard-resize-setting.test.tsxuses a deferred promise to assert both the normal refused-write read-back (switch returns to Off) and that a newer toggle supersedes an older failure's read-back; both would fail without the sequence guard. - Restored reducer coverage for the opt-in path —
terminal-viewport-refit.test.tsagain exercisesreduceTerminalFrameHeightRefitwithresizeForKeyboard = truewhile the keyboard is visible: a height change refits immediately (pendingstays false) and a debounce-window commit fires. This closes the coverage ask from the prior review.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
terminal-viewport-refit.ts가 모바일 max-lines 예산(빈 줄과 주석을 뺀 300줄)에 이미 붙어 있어서, 이 PR이 더한 키보드 리사이즈 분기 때문에 oxlint가 실패했다. 이 PR도 #20489도 건드리지 않는 iOS 복귀와 재연결의 강제 refit effect 두 개를 동작 변경 없이 terminal-viewport-reassertion.ts로 옮겼다. AGENTS.md가 max-lines 예외를 금지하므로 예외는 추가하지 않았다. Constraint: 모바일 oxlint max-lines 300(빈 줄·주석 제외)이며 파일별 예외 추가는 금지된다 Rejected: 키보드 리사이즈 분기를 다른 파일로 이동 | 이 PR의 변경 의도가 흩어지고 #20489와 충돌 범위가 커진다 Directive: #20489에도 같은 내용의 같은 파일을 넣었으므로 먼저 머지되는 쪽의 변경과 동일하게 맞춘다 Tested: oxlint와 전체 모바일 검사는 main 병합 상태에서 실행
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — reviewed the delta since the prior pullfrog review (2b40134d77) against the full 20-file diff. The only production change is a max-lines split with no behavioral surface.
- Extracted the viewport reassertion effects into a new hook — the iOS-resume
AppStateeffect and the reconnect refit effect moved unchanged out ofuseTerminalViewportRefitintouseTerminalViewportReassertion(mobile/src/terminal/terminal-viewport-reassertion.ts), becauseterminal-viewport-refit.tswas at the mobilemax-linesbudget. Same hook order, guards and deps; the one difference is a behavior-neutralupdateViewportCapabilityRefentry added to the reconnect effect's dep array (a stableuseRefobject, so it cannot re-run the effect). - Imports follow the move —
AppState,Platform,AppStateStatusandshouldRecoverTerminalOnAppStateChangenow live in the new module;terminal-viewport-refit.tsimports the hook. No test or registry referenced the old inline location.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
PR #23419의 오래된 head에 최신 origin/main을 병합하고, Android 키보드 리사이즈와 모바일 터미널 재구독 동작을 유지하도록 충돌을 해결했다. Constraint: PR의 base main이 현재 origin/main과 크게 달라져 모바일 저장소와 터미널 refit 경로에서 충돌이 발생했다. Rejected: main 쪽 삭제를 그대로 적용 | PR이 추가한 Android 키보드 리사이즈 동작과 포그라운드 재구독 상태가 사라진다. Confidence: high Scope-risk: broad Reversibility: moderate Tested: mobile Vitest 3개 파일 49개 테스트 통과; mobile Oxlint 통과 Not-tested: mobile 전체 타입 검사는 기존 의존성 누락(typescript-api, oxc-parser, @types/react-dom)으로 완료하지 못했다. Related: 61e8d3d
최신 main을 병합하고 Android 키보드 크기 조정 설정을 터미널 시작 전 설정 로딩 절차에 통합했다. 이전 병합에서 되살린 셸 선택 설정과 중복 재구독 상태 조작을 제거해 업스트림의 현재 처리 경로를 유지했다. Tested: 설정 지연 로딩, iOS 설정 격리, 키보드 리사이즈, 재구독 스냅샷 등 67개 테스트와 모바일 타입 검사 통과 Related: stablyai#23419
키보드 크기 조정 설정을 OTA 저장 브리지 허용 목록과 기존 저장 미러에 연결했다. 최신 셸에서 설정 쓰기가 버려지거나 다음 화면 초기화에서 저장값이 빠지는 문제를 방지했다. Tested: 수정 전 저장 브리지와 초기화 데이터 검증 2개 실패 재현, 수정 후 관련 테스트 95개와 모바일 테스트 타입 검사 및 check:changed 11개 검사 통과 Related: stablyai#23419
최신 설정 화면과 분할 터미널 구조에 Android 키보드 크기 조절을 통합했다. 표시 중인 터미널이 모두 휴대전화 크기를 사용할 때만 공통 영역을 줄이고, 크기 조절 뒤 키보드와 토스트를 중복 이동하지 않도록 했다. 새 설정 키는 이를 선언한 웹 화면에만 전달하도록 맞췄다. Constraint: 데스크톱이 크기를 소유한 터미널과 이전 웹 화면의 동작을 보존했다. Tested: 관련 테스트 157개, 모바일 타입 및 테스트 타입 검사, 변경 파일 oxlint와 oxfmt 검사를 통과했다. Not-tested: 실제 Android 기기에서의 키보드 동작은 이번 변경에서 확인하지 않았다.

ELI5
On Android, when you open the on-screen keyboard in a mobile terminal, the input bar slides up over the bottom of the terminal, and the terminal slides up with it as far as it needs to keep the cursor and the program's last rows in view. The rows pushed off the top of the screen stay hidden until you close the keyboard, so a full-screen program such as vim, htop or an agent's TUI loses its top part. This PR adds an Android setting, Resize terminal for keyboard, that is off by default. When you turn it on, the terminal shrinks to the space above the keyboard instead and the program redraws into the smaller size, so the whole terminal, top to bottom, stays on screen while you type. The cost is that every keyboard open or close resizes the terminal, and the setting's description says so.
What Changed
Before (Android, and still the default): opening the keyboard moves the command dock up with a
translateYand lifts the terminal pane only as far as the cursor needs. The terminal keeps its rows. Height refits are held back while the keyboard is up and run once after it closes.After, with the setting on:
reduceTerminalFrameHeightRefitno longer holds it back while the keyboard is visible. After the existing 150 ms debounce, the phone measures the new grid and sends it with the existingterminal.updateViewportcall. The host refits the PTY to fewer rows. Closing the keyboard does the reverse.computeActiveTerminalKeyboardLift) is 0, because the frame no longer sits under the keyboard.adjustResize) is no longer deferred either.Setting and storage:
hostOs() === 'android'. It lives in a new component,mobile/src/terminal/TerminalKeyboardResizeSetting.tsx, next to the settings screen's other rows.orca:terminalKeyboardResizeEnabled. A missing or unreadable value means off.Toast fix that comes with the feature: the terminal frame's toast ("Copied", send errors, ...) used the same
translateY: -keyboardLiftas the other frames. With the setting on, the dock padding has already raised the frame's bottom above the keyboard, so the toast was lifted twice. On a short window it could be pushed out of the frame, which clips (overflow: hidden), and never be seen. The terminal frame now has its own toast style with no lift when the setting is on. Markdown, file and browser frames have no command dock and keep the full lift. Native chat hides the dock, so its terminal toast keeps the full lift too.Other files:
mobile-session-route-parity.test.tsused to pin this PR's extra hooks and callbacks; upstream removed the whole parity test in test: remove junk tests that assert source text instead of behavior #23815 along with the other source-text assertions.docs/site/content/docs/mobile.mdxlists the setting under Terminal settings. It says what the default does and that turning it on resizes the terminal on every keyboard toggle.Why
Why upstream translates the dock today. #1700 (May 2026; its "Polish mobile terminal keyboard behavior" change) replaced a dock
paddingBottomwith atranslateY"without changing the terminal frame height, so keyboard open/close does not resize the desktop PTY." #8647 and #8707 (July 2026) then added height refits and kept that guarantee on purpose: height refits are held while the keyboard is visible, merged into one refit after it closes, and checked again when the debounce fires "so we never reflow the PTY mid-keystroke." This PR keeps all of that as the default. With the setting off, nothing in those paths changes.Why an opt-in is still worth having. The translate approach keeps the cursor and the program's last rows in view by pushing the terminal's top rows off the screen. On a phone, the keyboard takes about half the height, so a full-screen program, including an agent CLI's TUI, loses its top half while you type. Some users would rather see the whole program laid out for the space that is left and accept a redraw on each keyboard toggle. The host already expects this: the comment on
updateMobileViewport(src/main/runtime/orca-runtime-mobile-took-floor.ts) describes it as "used when the mobile keyboard opens/closes and shrinks/grows the visible terminal area". It updates the PTY size in place, so the phone keeps its subscription and the size the desktop returns to later is not overwritten.What turning it on costs. The setting's description states this, and so do the docs:
auto) mode the host callsptyController.resizeon each keyboard open and close, so the program getsSIGWINCHand redraws. The desktop pane is already showing that terminal at phone size while the phone drives it, so its row count changes too. The size the desktop returns to when the phone leaves is unchanged: that baseline comes from the desktop renderer's geometry (pickEarliestRestoreTarget), andupdateMobileViewportdoes not touch it.lastActedAt, so this phone becomes the one whose size drives the PTY. Rotation and fold refits already do the same.ptyController.resizepath that rotation and fold refits use. For SSH-backed PTYs that is the relay's resize RPC. There is no new RPC, field or stream opcode, so mixed client and host versions behave as they do today. Hosts too old to haveterminal.updateViewport(added in Mobile improvements: scrollback hydration, keyboard layout, and worktree-creation polish #1423) fall back to unsubscribe and resubscribe on every toggle, the same fallback every refit already uses.applied: falseand leaves the PTY alone. The phone's frame still shrinks, and because the cursor-anchored lift is 0 with the setting on, any rows that no longer fit the shorter frame are hidden until the keyboard closes. I have not tested this case; it is a limitation of the opt-in.Why Android only, and why off by default. Off by default keeps upstream's guarantee for everyone who does not ask for the change. Android is where this was built and tried. iOS computes the keyboard lift differently (its keyboard height includes the home-indicator inset) and has its own resume refit, and I have not evaluated either, so the switch is hidden there.
Alternatives considered:
adjustRowsForViewportinmobile/src/terminal/document/fit-scale.tsis a deliberate no-op because resizing only the WebView's xterm moves cursor coordinates and makes TUI repaints duplicate or overlap.terminal.updateViewportalready refits in place and is what every other phone refit uses.Linked Issue
Fixes #25497
Related: #18359 (Android split-screen keyboard inset), which is adjacent but does not resize the terminal.
Visual Proof
No screenshot or recording is attached; attachments could not be uploaded from the environment this PR was prepared in.
What I saw on a headless Android emulator (API 33) against the mock server, through screenshots I took for my own inspection:
hostOs() === 'android'.terminal.updateViewportwithout sending a resize back, so no rows were pushed off the top and no program redrew. The row change (54 × 45 → 54 × 25 → 54 × 45) shows up only in the mock'sterminal.updateViewportlog (see Testing).What a reviewer should expect on a real host with a full-screen program open and the keyboard up. I have not observed this:
Testing
Prebuilt APK for trying this on a phone: https://github.com/kargnas/orca/releases/tag/preview-mobile-20261005-f1d7719. It contains this PR and my other open mobile PRs on top of
main40f9e7a3fc, and installs next to the regular app as "Orca Preview". On an Android 13 emulator it launched, paired withmobile/scripts/mock-server.tsand painted the terminal.End to end (headless Android emulator, API 33): a debug build of this branch (
expo prebuildplus./gradlew --no-daemon :app:assembleDebug) paired withmobile/scripts/mock-server.ts. The stock mock answersterminal.updateViewportwithmethod_not_found, so for this run only I added two local log lines and aterminal.updateViewportreply of{ updated: true, applied: true }to the mock. That edit is not part of this PR. With one terminal open (subscribed at 54 × 45):The switch kept its value after leaving and reopening Settings → Terminal, and the session picked it up on return without a restart.
Physical device, on be2caacc91 (the same code as e008f38b0b, rebased): a release APK (arm64) installed on a Galaxy Z Fold7 (SM-F966N, Android 16) next to the existing Orca app under a separate application id, paired with the mock server over
adb reverse, cover screen, Samsung Keyboard:terminal.updateViewportand no re-subscribe.terminal.updateViewportand re-subscribed the terminal; closing it re-subscribed again. On screen the terminal stayed under the header and ended above the command dock and keyboard instead of sliding up. The mock does not log the size parameters, so the row counts come from the emulator run above.Switchwhose description is "Resize terminal for keyboard", and the value persisted after leaving Settings.Automated, on the feature commit (c8db8e3873, now c68ce7bad7 after rebases that only re-measured route-parity pins):
cd mobile && pnpm exec tsc --noEmitpasses.cd mobile && pnpm check:tests-typecheckpasses.cd mobile && pnpm testpasses: 892 files, 9634 tests passed, 6 skipped. New and updated tests:mobile-session-terminal-toast-lift.test.tsxrenders the presentation hook and checks the toast lift: full lift with the setting off, no terminal-toast lift with it on, and full lift again under native chat. With the old shared toast style, the "on" case fails.terminal-viewport-refit.test.tscovers the reducer refitting while the keyboard is visible when the option is on, and the wiring.preferences.test.tscovers the stored value: off when unset or unreadable, and saving true and false.cd mobile && pnpm lint && pnpm format:checkpass, and so dooxlint/oxfmt --checkon the changed files.oxfmt --checkalso passes onmobile.mdx.pnpm run check:code-quality:changedat the repo root reports 0 new findings across the 17 changed code files.pnpm exec vitest run --config config/vitest.config.tsonmobile-web-app-session-terminal-closure,mobile-web-app-page-closure-families,mobile-mirrored-storage-write-path,mobile-web-app-screencast-lane-grantandmobile-set-native-props-web-siblings(5 files, 36/36).accessibilityLabelto the switch):tsc --noEmit,check:tests-typecheck, thesrc/terminaland route-parity tests (70 files, 653 tests),oxlint/oxfmt --checkon the file, andcheck:code-quality:changedpass again.main67581dd (conflicts in the route-parity pins only): mobiletsc --noEmit,check:tests-typecheck,pnpm test(9723 passed, 6 skipped), the session-terminal closure test, andcheck:code-quality:changedpass.main21f8e0f (feature commitf0cf0cae11, label commitd1a2941cf5): upstream'sPlatform.OS→hostOs()migration (feat(mobile): the keyboard covers the page like a native screen, and the shell says its height #23110) is applied to this PR's new reads interminal-settings.tsxanduse-mobile-session-preference-focus.ts(the host-OS census flags them otherwise),terminalFrameRefreads are optional-chained for hook tests that omit it, and aprevResizeForKeyboardRefeffect reschedules a refit when the option toggles while the keyboard is visible (review finding F2). Mobiletsc --noEmit, the host-OS census, toast-lift, refit and route-parity tests, andpnpm test(9758 passed, 6 skipped) pass.main31012ae (feature487216d453, labelcd8ab75e5b): upstream's test: remove junk tests that assert source text instead of behavior #23815 cleanup deletedmobile-session-route-parity.test.tsand the source-text refit tests (including the mid-keyboard toggle test added for the F2 review — the effect itself remains interminal-viewport-refit.ts); both conflicts tookmain's side. Mobiletsc --noEmit,check:tests-typecheck,pnpm test(9651 passed, 6 skipped), andcheck:code-quality:changedpass.63d86bce03,5c20140e0f): the keyboard-resize shrink (dock padding, cursor lift, terminal toast) is gated onisTerminalPhoneDisplayMode, so a terminal whose dims the desktop holds keeps the slide-and-lift behavior and no rows are clipped — this replaces the "desktop holds the size" limitation noted under Why. A refused preference write now re-reads storage so the switch shows what was actually kept. Mobiletsc --noEmit,check:tests-typecheck, the session suite (191 files, 1856 tests), andcheck:code-quality:changedpass.75a4037fe9,2b40134d77): a refused save's read-back now applies only while its toggle is still the latest, so an older failure can no longer overwrite a newer choice —terminal-keyboard-resize-setting.test.tsxpins the interleaving and the normal read-back. TheresizeForKeyboardreducer branch regained a behavior-level test after upstream's cleanup (immediate refit while typing, debounce commit that fires). Mobiletsc --noEmit,check:tests-typecheck, focused vitest (10 tests), andcheck:code-quality:changedpass.61e8d3d10e:terminal-viewport-refit.tswas already at the mobilemax-linesbudget (300 lines, blanks and comments excluded), so this PR's keyboard-resize branches failedoxlint. The iOS-resume and reconnect refit effects, which neither this PR nor fix(mobile): stabilize terminal startup and Android window rendering #20489 changes, moved unchanged intoterminal-viewport-reassertion.ts; fix(mobile): stabilize terminal startup and Android window rendering #20489 adds the identical file. With the branch merged into currentmain(752871bd67), mobileoxlint,oxfmt --check,tsc --noEmit,check:tests-typecheck, the session-terminal closure test andpnpm test(9870 passed, 6 skipped) pass. The only failures are two tests insrc/tasks/mobile-agent-launch-architecture.test.ts, which fail the same way on plainmainlocally.Not verified:
terminal.updateViewportlog.SIGWINCHin a real program, and the SSH path were not exercised. They go through the existingupdateMobileViewport→ptyController.resizepath.AI Disclosure
Developed with Claude Code (Claude Opus 5.5).
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
main.terminal.updateViewportit sends for rotation and fold, only more often while the setting is on. See Why for SSH, other clients and old hosts.Platform.OS === "web", so the setting has no effect there.Checklist
N/Awith reason (no attachments; see Visual Proof for what was and was not observed)pnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred). This is a mobile-only change, so the mobile equivalents and the root changed-code gate were run locally; the desktop suites are left to CI.