Files
orca/tests
JinjingandOrca 98e3511c9e fix(terminal): reconcile PTY size after spawn to fix first-mount column desync
Interactive TUIs (e.g. Claude Code) could render garbled — output wrapped
at ~1 column, overlapping text — when a terminal's pane layout had not
settled by the first animation frame. The deferred-rAF fit then spawned the
PTY at the wide window width while xterm later reflowed to the real (narrower)
pane width. The corrective onResize was dropped (cols already matched at fit
time, or isRendererPtyResizeAuthoritative() was false mid-mount), so
process.stdout.columns stayed pinned to the stale width forever and the TUI
emitted wide output into a narrow pane.

Fix: after the PTY id resolves, re-fit once layout has settled and force the
PTY to xterm's current dimensions if they differ from the spawn dimensions.
The initial spawn-time sync is authoritative by definition, so it bypasses
the visibility gate — but still respects the mobile-fit override/lock, which
legitimately parks the PTY at phone dims.

Verified with tests/e2e/terminal-column-desync-repro.spec.ts: the
'during initial mount' golden repro fails without this change and passes
with it; all 5 scenarios (visible resize, hidden resize, repeated background
resize, split reparent, initial mount) pass.

Repro spec co-authored via orchestration.

Co-authored-by: Orca <help@stably.ai>
2026-06-28 13:33:07 -07:00
..