Repository navigation
[Bug]: Shared terminal is clipped when desktop and native Android use different sizes #14463
Description
Activity
Triage
Confirmed on
main(c2fa9fc). A terminal session has a single PTY size, and whichever client last sent its dimensions wins. The other client isn't told, so its local grid drifts away from the PTY. That explains both symptoms you described: a desktop-sized TUI clipped on the phone, and a phone resize leaving the desktop TUI stuck at the phone's column count.Server side.
TerminalResizeInputonly carriesthreadId,terminalId,cols, androws, with no client identity.resizeLockedinapps/server/src/terminal/Manager.tsresizes the shared PTY, storessession.cols/session.rows, and returns without publishing anything.TerminalSessionSnapshotandTerminalSummarydon't include geometry, andTerminalEventhas no resize event, so an attached renderer never learns about the new grid.manager.opendoes the same last-writer update when an existing session is opened at a different size, and the test "resizes running terminal on open when a different size is requested" locks that behavior in.Client side. Both clients write their own size into that one slot:
- Native Android sends
cols/rowson attach (ThreadTerminalRouteScreen) and again fromhandleResize. The native view fires that on any size change, including the keyboard opening (T3TerminalView.onSizeChanged→emitResize). - The web drawer doesn't send a size on attach. After layout, Ghostty's
fit()callsonResize, which sendsterminal.resize(debounced 150 ms insurface.ts). So attaching or resizing the desktop panel overwrites the phone's size, and vice versa.
A container that doesn't change size won't re-fit, so once the phone is the last writer,
stty sizeon the wide client stays at the phone's grid. That matches your 15×54 reading from the 1146 px view while a 430 px view was attached.This isn't the same as #8253 (open issue, Android Backspace) or #12756 (open issue, per-key echo latency), and the open PRs #11235 (incremental output) and #9456 (input batching) don't touch geometry. Nothing else currently tracks shared PTY size.
Since a PTY can only have one size, the fix needs a policy. Either one client owns the size and the others scroll or scale to that grid, or there's an explicit shared grid plus a geometry event that every attached renderer applies. Until then, your workaround is the right one: keep only one terminal view attached at a time. Thanks for the careful reproduction.
- Native Android sends
- addedbugSomething is broken or behaving incorrectly.Something is broken or behaving incorrectly.via-triageFiled through npx t3 triageFiled through npx t3 triage
on Sep 30, 2026
Area
apps/server, apps/mobile, apps/web
Steps to reproduce
Expected behavior
Both clients remain usable. The terminal should have a defined policy for its shared PTY dimensions, and attached renderers should agree with those dimensions. The smaller client should be able to see the whole TUI, for example by using a shared grid with scrolling or an explicit size owner.
Actual behavior
The TUI fits one device but is clipped or leaves an unexpectedly narrow layout on the other. A desktop-sized TUI can be cut off on Android; after the phone resizes it, desktop output can stay constrained to the phone's columns.
Impact
Major degradation when moving between desktop and phone while keeping an agent session alive.
Environment and evidence
The original report is from the native Android app, not a mobile browser. The exact installed mobile version is unknown. Source inspection used main at c2fa9fc.
The server currently keeps one
cols/rowspair per terminal.openOrAttachForStreamandresizeLockedinapps/server/src/terminal/Manager.tsresize that shared PTY to the requesting client's dimensions.TerminalResizeInputhas no client identity or size ownership, and there is no geometry-change event that makes the other renderer adopt the new grid.The existing server test "resizes running terminal on open when a different size is requested" confirms the last-attaching-client behavior. In an isolated web dev environment I attached two views to the same terminal, left one surface 1146px wide and narrowed the other to 430px. Running
stty sizefrom the wide view reported15 54, consistent with the narrow client's PTY width. This is browser evidence for shared server behavior, not native Android verification.This report is separate from Android Backspace #8253 and per-key echo latency #12756. Incremental output and input batching work in #11235 and #9456 may help latency, but do not establish shared terminal geometry.
Workaround
Only keep one terminal view attached at a time. This defeats seamless desktop/phone use.