Skip to content

fix(mobile): animate Android terminal insets with the keyboard - #21751

Closed
only21mil wants to merge 11 commits into
pingdotgg:mainfrom
only21mil:batch/a3-3-android-terminal-insets
Closed

only21mil wants to merge 11 commits into
pingdotgg:mainfrom
only21mil:batch/a3-3-android-terminal-insets

Conversation

@only21mil

@only21mil only21mil commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On Android, the native terminal jumps to the keyboard's final height at the start of the IME animation. On hide, the accessory disappears before the viewport returns to its closed size, causing an intermediate PTY resize.

Change

Animate the Android terminal viewport and bottom controls from keyboard height and progress. Keep the accessory mounted through hide, measure the idle footer to preserve the closed grid, and send the PTY resize after the measured grid has been stable for 120 ms. Cancel stale resize targets and recheck permission before dispatch.

Scope

Bug fix for an Android layout bug. Fixes #14464. juliusmarminge's triage comment approves the fix direction: animate the terminal viewport with the keyboard inset and defer PTY resizing until the animation settles.

Verification

Revisions: main 7462f234e8, this head 066737c6cd, and the head merged locally with that main, caeeaf15c6 (not pushed). A probe terminal logs each SIGWINCH; three keyboard show and hide cycles per run.

Android (Pixel 10 emulator, Android 16, Gboard, software rendering): main sends one resize per show and two per hide (27, 30, 48 rows with gesture navigation; 27, 30, 46 with three-button); head and merged send one per show and one per hide (27, 48 or 27, 46 rows). In the first merged run, right after install, the first two shows each sent one extra resize (36 and 39 rows before 27); a repeat run of five cycles and a run after a cold relaunch sent one per transition.

iOS (iPhone 17 Pro simulator, iOS 26.5): main, head and merged behave the same, one resize per show (19 rows) and two per hide (22, then 37 rows). This PR leaves iOS unchanged; iOS still passes through the intermediate grid on hide.

The two session-store tests in packages/client-runtime/src/state/terminal.test.ts fail on main's session store (2 failed, 12 passed) and pass on the head and on the merged tree (14 passed).

Android, main 7462f23, gesture navigation: recording frame during a hide; the probe shows an intermediate 30-row grid and the footer is not drawn

Android, main 7462f234e8, gesture navigation: recording frame during a hide; the probe shows an intermediate 30-row grid and the footer is not drawn

Android, head 066737c, gesture navigation: recording frame during a hide; the grid stays at 27 rows and the footer is drawn

Android, head 066737c6cd, gesture navigation: recording frame during a hide; the grid stays at 27 rows and the footer is drawn

Not checked: interactive swipe dismiss, rotation, a second client on the same PTY, physical devices, other IMEs, Android with host-GPU rendering, and the web terminal (its session store keeps the immediate default).

Method, probe logs and more stills

The first merged run's extra resizes came right after the client was installed and the bundle first loaded.

Revisions were run in this order: main 7462f234e8 (newest main with a green push CI run), head, merged. This is a TypeScript-only change to Android terminal layout and its grid-sync scheduling. Verification reused the existing native development client.

Method: one T3 test server from main (the change is client-only), a synthetic project, and a terminal shell that is a probe drawing the PTY grid and logging each SIGWINCH. Each revision ran its own Metro and the dev client for its own native fingerprint; resizeSettleDelayMs occurs 0 times in main's served bundle and 3 times in head's and merged's. Input through the T3 Device panel: tap Show keyboard, wait 4 s, then the system Back button (Android) or the accessory's Dismiss keyboard button (iOS), three cycles per run. Android ran software rendering (SwiftShader) with gesture and three-button navigation.

Main 7462f234e8, gesture navigation, probe log:

2026-11-12T03:20:09.690Z ==== android-main-7462f234e8-gesture begin
2026-11-12T03:20:12.986Z run resize #5 27x64
2026-11-12T03:20:17.476Z run resize #6 30x64
2026-11-12T03:20:17.897Z run resize #7 48x64
2026-11-12T03:20:22.201Z run resize #8 27x64
2026-11-12T03:20:26.339Z run resize #9 30x64
2026-11-12T03:20:26.807Z run resize #10 48x64
2026-11-12T03:20:31.012Z run resize #11 27x64
2026-11-12T03:20:35.355Z run resize #12 30x64
2026-11-12T03:20:35.774Z run resize #13 48x64
2026-11-12T03:20:41.767Z ==== android-main-7462f234e8-gesture end

Head 066737c6cd, gesture navigation:

2026-11-12T03:23:25.654Z ==== android-head-066737c6cd-gesture begin
2026-11-12T03:23:30.625Z run resize #2 27x64
2026-11-12T03:23:34.047Z run resize #3 48x64
2026-11-12T03:23:38.650Z run resize #4 27x64
2026-11-12T03:23:43.439Z run resize #5 48x64
2026-11-12T03:23:47.886Z run resize #6 27x64
2026-11-12T03:23:52.428Z run resize #7 48x64
2026-11-12T03:23:58.348Z ==== android-head-066737c6cd-gesture end

Main 7462f234e8, three-button navigation:

2026-11-12T03:21:18.154Z ==== android-main-7462f234e8-threebutton begin
2026-11-12T03:21:22.190Z run resize #15 27x64
2026-11-12T03:21:25.953Z run resize #16 30x64
2026-11-12T03:21:26.472Z run resize #17 46x64
2026-11-12T03:21:30.718Z run resize #18 27x64
2026-11-12T03:21:35.009Z run resize #19 30x64
2026-11-12T03:21:35.483Z run resize #20 46x64
2026-11-12T03:21:39.787Z run resize #21 27x64
2026-11-12T03:21:43.959Z run resize #22 30x64
2026-11-12T03:21:44.430Z run resize #23 46x64
2026-11-12T03:21:50.409Z ==== android-main-7462f234e8-threebutton end

Head 066737c6cd, three-button navigation:

2026-11-12T03:24:12.285Z ==== android-head-066737c6cd-threebutton begin
2026-11-12T03:24:16.536Z run resize #9 27x64
2026-11-12T03:24:20.655Z run resize #10 46x64
2026-11-12T03:24:25.184Z run resize #11 27x64
2026-11-12T03:24:29.669Z run resize #12 46x64
2026-11-12T03:24:34.172Z run resize #13 27x64
2026-11-12T03:24:38.707Z run resize #14 46x64
2026-11-12T03:24:44.665Z ==== android-head-066737c6cd-threebutton end

Merged caeeaf15c6, gesture navigation, first run:

2026-11-12T03:25:42.483Z ==== android-merged-caeeaf15c6-gesture begin
2026-11-12T03:25:47.246Z run resize #2 36x64
2026-11-12T03:25:47.716Z run resize #3 27x64
2026-11-12T03:25:50.880Z run resize #4 48x64
2026-11-12T03:25:55.221Z run resize #5 39x64
2026-11-12T03:25:55.588Z run resize #6 27x64
2026-11-12T03:26:00.122Z run resize #7 48x64
2026-11-12T03:26:04.620Z run resize #8 27x64
2026-11-12T03:26:09.243Z run resize #9 48x64
2026-11-12T03:26:14.956Z ==== android-merged-caeeaf15c6-gesture end

Merged caeeaf15c6, gesture navigation, repeat run:

2026-11-12T03:26:27.930Z ==== android-merged-caeeaf15c6-gesture-rerun begin
2026-11-12T03:26:32.197Z run resize #10 27x64
2026-11-12T03:26:36.485Z run resize #11 48x64
2026-11-12T03:26:41.027Z run resize #12 27x64
2026-11-12T03:26:45.608Z run resize #13 48x64
2026-11-12T03:26:50.207Z run resize #14 27x64
2026-11-12T03:26:54.801Z run resize #15 48x64
2026-11-12T03:26:59.456Z run resize #16 27x64
2026-11-12T03:27:03.839Z run resize #17 48x64
2026-11-12T03:27:08.389Z run resize #18 27x64
2026-11-12T03:27:12.828Z run resize #19 48x64
2026-11-12T03:27:18.726Z ==== android-merged-caeeaf15c6-gesture-rerun end

Merged caeeaf15c6, three-button navigation:

2026-11-12T03:28:48.867Z ==== android-merged-caeeaf15c6-threebutton begin
2026-11-12T03:28:52.988Z run resize #9 27x64
2026-11-12T03:28:57.162Z run resize #10 46x64
2026-11-12T03:29:01.649Z run resize #11 27x64
2026-11-12T03:29:06.231Z run resize #12 46x64
2026-11-12T03:29:10.454Z run resize #13 27x64
2026-11-12T03:29:15.086Z run resize #14 46x64
2026-11-12T03:29:21.037Z ==== android-merged-caeeaf15c6-threebutton end

iOS main 7462f234e8:

2026-11-12T03:32:09.653Z ==== ios-main-7462f234e8 begin
2026-11-12T03:32:13.926Z run resize #9 19x47
2026-11-12T03:32:18.980Z run resize #10 22x47
2026-11-12T03:32:19.664Z run resize #11 37x47
2026-11-12T03:32:24.128Z run resize #12 19x47
2026-11-12T03:32:29.196Z run resize #13 22x47
2026-11-12T03:32:29.937Z run resize #14 37x47
2026-11-12T03:32:34.667Z run resize #15 19x47
2026-11-12T03:32:39.727Z run resize #16 22x47
2026-11-12T03:32:40.462Z run resize #17 37x47
2026-11-12T03:32:54.420Z ==== ios-main-7462f234e8 end

iOS head 066737c6cd:

2026-11-12T03:38:14.152Z ==== ios-head-066737c6cd begin
2026-11-12T03:38:18.132Z run resize #5 19x47
2026-11-12T03:38:23.085Z run resize #6 22x47
2026-11-12T03:38:23.827Z run resize #7 37x47
2026-11-12T03:38:28.230Z run resize #8 19x47
2026-11-12T03:38:33.351Z run resize #9 22x47
2026-11-12T03:38:34.041Z run resize #10 37x47
2026-11-12T03:38:38.477Z run resize #11 19x47
2026-11-12T03:38:43.547Z run resize #12 22x47
2026-11-12T03:38:44.282Z run resize #13 37x47
2026-11-12T03:38:55.773Z ==== ios-head-066737c6cd end

iOS merged caeeaf15c6:

2026-11-12T03:40:46.164Z ==== ios-merged-caeeaf15c6 begin
2026-11-12T03:40:50.124Z run resize #24 19x47
2026-11-12T03:40:55.243Z run resize #25 22x47
2026-11-12T03:40:55.931Z run resize #26 37x47
2026-11-12T03:41:00.413Z run resize #27 19x47
2026-11-12T03:41:05.427Z run resize #28 22x47
2026-11-12T03:41:06.161Z run resize #29 37x47
2026-11-12T03:41:10.593Z run resize #30 19x47
2026-11-12T03:41:15.719Z run resize #31 22x47
2026-11-12T03:41:16.458Z run resize #32 37x47
2026-11-12T03:41:28.064Z ==== ios-merged-caeeaf15c6 end

Android, main 7462f23, three-button navigation, closed: probe history 27, 30, 46 rows per cycle

Android, main 7462f234e8, three-button navigation, closed: probe history 27, 30, 46 rows per cycle

Android, head 066737c, three-button navigation, closed: probe history 27, 46 rows per cycle

Android, head 066737c6cd, three-button navigation, closed: probe history 27, 46 rows per cycle

Android, merged caeeaf15c6, three-button navigation, closed: probe history 27, 46 rows per cycle

Android, merged caeeaf15c6, three-button navigation, closed: probe history 27, 46 rows per cycle

iOS, main 7462f23, closed: probe history 19, 22, 37 rows per cycle

iOS, main 7462f234e8, closed: probe history 19, 22, 37 rows per cycle

iOS, head 066737c, closed: probe history 19, 22, 37 rows per cycle

iOS, head 066737c6cd, closed: probe history 19, 22, 37 rows per cycle

Recordings
main 7462f234e8 head 066737c6cd merged caeeaf15c6
Android, gesture recording recording first run, repeat
Android, three-button recording recording recording
iOS recording recording recording

Generated with GPT-6.1 Sol in T3 Code Nightly

Fixes #14464

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 19, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — This changes the default Android terminal path by adding keyboard-synchronized layout animation and deferring/collapsing shared PTY resize operations until the grid settles. The scope is focused and tested, but the cross-cutting production UI and terminal synchronization behavior warrants human review.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The terminal screen now animates Android viewport and control changes with keyboard progress. Terminal sessions can delay grid resizes until the layout settles. The mobile screen configures a 120 ms delay on Android and no delay on other platforms.

Changes: Terminal keyboard and grid synchronization

Layer / File(s) Summary
Settled terminal grid synchronization
packages/client-runtime/src/state/terminal.ts, apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx, packages/client-runtime/src/state/terminal.test.ts
TerminalSessionOptions adds resizeSettleDelayMs. The session delays grid resizes when configured and clears pending timers during cleanup. The mobile screen configures 120 ms on Android and 0 ms elsewhere. Tests cover settling, initial resize ordering, permission changes, generation changes, and detachment.
Android keyboard layout and controls
apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
The terminal viewport padding, bottom control bar, and keyboard accessory follow Android keyboard progress. The bottom bar becomes non-interactive and hidden from accessibility while the keyboard is visible. The previous Android screen-body bottom padding is removed.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: juliusmarminge, maria-rcks

Merge Risk: Minimal · up to 46db0

No actionable issue is established for the Android terminal keyboard change. It is ready to merge after normal checks.

Security architecture risk: Low · up to 730a4

The change remains narrowly scoped to Android terminal presentation and resize timing. Pending resizes are cancelled when their context changes, and permission is checked before dispatch. No new privilege path was demonstrated, although identity replacement and requests already in flight were not fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed mutation path affects shared dimensions of the addressed running terminal in the selected environment. It continues to require terminal-operation scope and does not introduce a client-supplied process identifier or new command-execution operation.

Trust Boundaries and Controls

  • observed — The delayed callback checks the current environment scope rather than relying solely on permission captured when scheduling. Existing command execution authorizes the origin and destination, and the server maps terminal resize to terminal-operation scope.

Resilience and Maintainability Implications

  • observed — Timer cleanup contains superseded work before dispatch; it does not retract a request already submitted. The server serializes resize through a thread lock, ignores absent or non-running sessions, and records dimensions only after the selected PTY resize succeeds. The hook adds no reservation or persistent intermediate state requiring rollback.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly summarizes the main change: animating Android terminal insets with the keyboard.
Linked Issues check Passed Issue #14464 asks the native Android terminal and keyboard accessory to move with the keyboard without an abrupt jump. The whole-PR diff adds Reanimated keyboard-height and progress styles to the Andr…
Out of Scope Changes check Passed The whole-PR diff changes only ThreadTerminalRouteScreen.tsx, terminal.ts, and terminal.test.ts. The screen changes and resize scheduling implement issue #14464. The tests verify that behavior. The op…
Description check Passed The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections. The Problem section states the Android viewport jump and the intermediate PTY resize …
Full details: Linked Issues check

Explanation

Issue #14464 asks the native Android terminal and keyboard accessory to move with the keyboard without an abrupt jump. The whole-PR diff adds Reanimated keyboard-height and progress styles to the Android terminal viewport and controls. It keeps the Android accessory mounted while the keyboard hides and measures the idle bottom bar. The Android terminal session uses a 120 ms resize delay. The session coalesces pending grid changes, cancels stale timers, and checks current operate permission before dispatch. Added tests cover settled-grid resizing, launch-input ordering, permission changes, detach, and generation changes. The issue's requests to check interactive dismissal, rotation, and a second desktop view are verification scenarios, not coding requirements.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff changes only ThreadTerminalRouteScreen.tsx, terminal.ts, and terminal.test.ts. The screen changes and resize scheduling implement issue #14464. The tests verify that behavior. The optional resizeSettleDelayMs setting supports the Android delay; other platforms pass 0. No unrelated change is demonstrated.

Full details: Description check

Explanation

The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections. The Problem section states the Android viewport jump and the intermediate PTY resize on hide. The Change section explains the animation, the kept-mounted accessory, the measured footer, and the 120 ms settled resize. The Scope section names a bug fix and links issue #14464 with a triage comment. The Verification section lists revisions, Android and iOS probe runs, unit test results, and screenshots or recordings. It also lists unchecked scenarios: interactive swipe dismiss, rotation, a second client on the same PTY, physical devices, other IMEs, host-GPU rendering, and the web terminal. The template asks for an agent attribution at the end, and the description includes one ("Generated with GPT-6.1 Sol in T3 Code Nightly"). The description is long, and the Verification section has many raw logs that could be trimmed, but it is still complete and specific.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6c97c48 and 46db0c6.

Files selected for processing: 1

  • apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

thanks @only21mil for the keyboard-progress padding, mounted controls, measured footer, and settled resize implementation. i preserved your commits and updated this original branch by merging github/main at f0dd86f164.

main moved terminal lifecycle into the session store and deleted useTerminalGridSync. i moved the optional 120 ms settle delay there instead of restoring the hook. initial attachment/generation resizing stays immediate before launch input; later grid changes coalesce, cleanup cancels pending work, and dispatch checks current permission. other clients keep immediate resizing. hidden android controls now leave native layout at the animation endpoints, and the footer retains its last positive measurement. the original diff was compared against the final implementation; the deleted hook is the only production mechanism moved.

verification on 08824a5153c99bd3d060e9e112ed0173fab2e2dd:

  • blacksmith vp run check:changed passes format, lint, both knip passes, seven affected package typechecks, and all 14 terminal session tests.
  • the two regressions added in the existing test file both failed against main's immediate-resize implementation before the fix. they cover coalescing, current permission, detach, generation changes, and resize-before-launch-input ordering.
  • two independent code review rounds identified hidden hardware-focus targets and zero-height footer measurement; both issues were addressed. no additional review round was requested.
  • 27 checks pass, none fail. coderabbit remains pending with an organization review-limit notice; it was not invoked manually.

unverified: current-head android ime animation, hardware-keyboard focus, gesture/three-button navigation, real pty resize counts through the native client, and ios interaction. device access is disabled in this environment and adb lists no devices. the original recordings remain historical evidence; no fresh before/after screenshots or video are claimed. chrome cannot establish native ime behavior. maintainer approval and native verification remain the handoff gates.

@juliusmarminge juliusmarminge added bugfix Fix PR opened by an issue lead; enters the PR loop pr:gate-failed A land gate failed labels Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

none of the changed behavior could be exercised on this linux boat vm. this is an unverifiable result, not a passing verification.

i read the description, discussion, commit authors and three-file diff at 08824a5153c99bd3d060e9e112ed0173fab2e2dd. the pr is open and contains no pr commits by juliusmarminge or t3dotgg. git.cafe reports 29 successful checks and no failing or pending checks; that does not prove runtime behavior.

the affected flow is the native android thread terminal: show the keyboard, let it settle, press back to hide it, and inspect viewport/accessory motion and real pty resize events. android opts into the 120 ms settled resize; web and other clients retain the immediate default.

runtime availability transcript:

$ adb devices -l
List of devices attached
[no devices]

$ device_list
Agent device access is turned off for this environment.

Not verified

baseline reproduction on github/main, current-head android keyboard animation, settled pty resize counts, gesture and three-button navigation, repeated show/hide, hardware-keyboard focus, rotation, permission changes and attachment/generation behavior remain unverified. ios also remains unverified.

the repository's test-t3-mobile skill requires stopping verification when device tools or the selected device are unavailable. no alternate device automation was installed. no dev server, worktree installation or provider turn was started after this blocker; a chrome browser and a codex turn cannot exercise the native android ime path. no fresh screenshots or video were captured, and historical contributor media is not claimed as evidence for this run.

no code, branches, labels or pr description were changed. verification needs enabled android device access and a native development client, followed by matching main/head runs through the actual terminal.

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

Verified on Android emulator (API 35) against a real dev server

verified head 08824a5153c99bd3d060e9e112ed0173fab2e2dd using the t3 android emulator, the cached native dev client, metro, and an isolated local dev server. created a real git project and two real codex gpt-6.1-sol turns, then opened the thread terminal in the app.

repeated keyboard show/back-dismiss twice in each navigation mode. a real terminal process recorded exactly one SIGWINCH per transition: gesture navigation changed between 64×47 and 64×26; three-button navigation changed between 64×46 and 64×26. no intermediate grid resize occurred. the settled last row and right edge remained visible, and the accessory followed the keyboard. transient terminal redraw/reflow remains visible during resizing.

neighboring checks passed: ctrl-c stopped the terminal probe, a subsequent shell command executed, the keyboard accessory hide control restored the footer, and attach output opened the terminal-output selection sheet.

no code changes were needed. existing CI reports 29 successful checks, zero pending and zero failing; checks were not rerun.

these screenshots show this head before and after opening the keyboard, not a main/head comparison.

terminal before opening the keyboard

terminal after opening the keyboard

two keyboard show and dismiss cycles with gesture navigation

two keyboard show and dismiss cycles with three-button navigation

Not verified

ios cannot run on this linux vm. the original problem was not reproduced on github/main. physical devices, other keyboards, rotation, interactive swipe dismissal, hardware-keyboard focus, and multi-client permission-generation behavior were not exercised.

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

merged github/main at 812c0a71c785 into the existing contributor branch without rebase or force-push. head: 6c97c48033f33d0aaf08556ff182f140f85e43c3.

the single conflict combined main's terminal menu simplification with the existing keyboard animation. main's native grid prop remains intact. scope remains three files, 141 additions and 29 deletions. two independent code reviewers approved this head with no concrete findings.

blacksmith vp run check:changed 812c0a71c785c69c34a0111c3ce6976f64cd5bfe passed format, lint, both knip checks, seven affected package typechecks, all 14 terminal tests, and scoped react compiler coverage. there were no failing CI logs on the previous head. new-head CI is pending.

unverified: native android runtime behavior on this merged head. device access is disabled and adb lists no devices; chrome cannot exercise native IME behavior. prior-head android evidence remains historical. macroscope's human-approval requirement still applies. no labels changed and no merge performed.

The terminal screen now reads keyboard showing from main's
terminalKeyboardShowing module, which hides the accessory on
keyboardWillHide on every platform. The Android-only switch to
keyboardDidHide is dropped: on Android the accessory and viewport
follow the keyboard's animation progress, and main's module needs
didHide to leave the accessory alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@only21mil

Copy link
Copy Markdown
Contributor Author

Note

🤖 Opus 5.5 replying on behalf of Victor.

Merged main (fa2f4ff2a2) into this branch as one merge commit, 46db0c6181, to clear the conflict in ThreadTerminalRouteScreen.tsx. No rebase and no force-push; every earlier commit is kept.

One part of this PR is dropped because main now covers it. The terminal screen reads keyboard showing from main's terminalKeyboardShowing module (#25847), so the PR's Android-only switch from keyboardWillHide to keyboardDidHide is gone. #25847 needs Android's keyboardDidHide to leave the accessory alone, and on Android the accessory and viewport here already follow the keyboard's animation progress. The animated insets, the measured footer and the 120 ms settled resize in the session store are unchanged.

Checked again on an Android 16 emulator (Pixel Fold AVD, software rendering, gesture navigation). A probe in the terminal logs every PTY resize, over two keyboard show and Back-dismiss cycles per build:

Build Resizes over two cycles Grid on each hide
main 6 24 → 28 → 43 rows
this head 4, one per show or hide 24 → 43 rows

A Pixel 10 AVD run of main showed the same pattern (27 → 30 → 48 rows on each hide).

vp run check:changed passes. The two settle tests fail on main's session store and pass on this head.

Before (main), Fold AVD:
https://gist.githubusercontent.com/only21mil/458c6b5603cfdb20aa7b8794f3140b89/raw/f0e4f6f50ceb7308d6c46739fe65df265580201e/merge-before-main-fold.mp4

After (this head), Fold AVD:
https://gist.githubusercontent.com/only21mil/458c6b5603cfdb20aa7b8794f3140b89/raw/f0e4f6f50ceb7308d6c46739fe65df265580201e/merge-after-fold.mp4

@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

in the real app the problem is still there, and the rework changed nothing:

Not fixed this round; nothing was pushed and the head is unchanged. The proof report says the problem still happens on the head but does not say what it observed. I set up an isolated server, a replay thread, a SIGWINCH probe in the terminal and a pooled Pixel 9 (API 36, Gboard). By mistake, Metro was started from the main checkout instead of the PR worktree, so every measurement ran main's mobile code, not this PR. That is also why temporary instrumentation and a resizeSettleDelayMs: 0 edit never took effect. What I measured matches the PR author's main baseline and confirms the reported bug on main: show sends one PTY resize (64x50 to 64x29), while every hide sends two (64x29 to 64x32, then 64x50 about 0.45 to 0.65 s later). The 3-row step matches the 52 dp accessory leaving before the keyboard closes. The device pool's worker then kept disconnecting from the gateway, including on a second, fresh lease, so I could not re-run against the PR head within the budget. Reading the PR code found nothing that explains a split resize: the native view emits a resize only on layout change, and the animated padding formula cannot lose just the accessory term while the keyboard is still fully open. So I made no code change without a measurement. Next round: start the server and Metro as separate commands using the worktree's absolute path, confirm the process on port 8081 has its cwd in the worktree, then count SIGWINCH per hide on the PR head. For per-frame grids, temporarily set resizeSettleDelayMs to 0 and send probe data with fetch to an HTTP listener on the VM, because app console output does not reach Metro.

It stays open for a person to finish or close.

@only21mil

only21mil commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Note

🤖 Opus 5.5 replying on behalf of Victor.

@juliusmarminge The run in this stop measured main's mobile code, as the note says, so its two resizes per hide are main's bug; my main baseline on the same emulator shows the same pattern (24 → 28 → 43 rows on each hide). On this PR's code at 46db0c6181 I recorded one PTY resize per show or hide on a software-rendered Android 16 Pixel Fold emulator, two cycles of tapping Show keyboard with Gboard and pressing the system Back button, with the grid going 24 → 43 rows on each hide and no intermediate step. The before and after videos, with the resize probe visible in the terminal, are in my comment above. The PR's own patch is byte-identical at 46db0c6181 and at 066737c6cd; only main moved underneath it.

On the head 066737c6cd itself, with Metro serving that checkout: one PTY resize per show (to 27×64) and one per hide (straight back to 48×64) over five cycles, on a software-rendered Android 16 Pixel emulator with Gboard, the keyboard shown by tapping Show keyboard and hidden three times with the system Back button and twice with Gboard's own hide key. Main at 034f3ba918, in the same session and steps, sent two resizes on every hide (30×64, then 48×64). Recordings with the resize probe visible: head 066737c6cd and main 034f3ba918; the unedited probe output and settled stills are in this gist.

@t3dotgg

t3dotgg commented Nov 12, 2026

Copy link
Copy Markdown
Member

Note

🤖 Claude Opus 5.5 responding on behalf of Theo

Closing. This PR has been open for more than 3 weeks, and main has moved a long way since then. If the change still matters, open a fresh PR from current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fix PR opened by an issue lead; enters the PR loop pr:gate-failed A land gate failed size:M 30-99 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Native Android terminal jumps upward when the keyboard opens

4 participants