You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposes a potential fix for the terminal UI breakage reported in #7951. When a hidden terminal becomes visible, the PTY size reassertion captures xterm dimensions and asynchronously reads the size applied to the PTY. A reveal-time fit can change xterm while that read is in flight; the old callback can then resize the PTY back to the pre-reveal grid, matching the report that affected sessions remain at 80x24 or an extremely narrow size until a manual window resize repairs them.
This change re-measures xterm after the applied-size read. If the visible grid changed, it suppresses the stale resize and queues a fresh reconciliation pass against the latest dimensions. A regression test covers a reveal-time change from 80x24 to 145x78 and verifies that the stale 80x24 target is never forwarded.
Screenshots
No visual change.
Testing
pnpm lint (not run end-to-end; targeted oxlint passed)
pnpm typecheck (not run end-to-end; pnpm run typecheck:web passed)
pnpm test (not run end-to-end; focused test file passed 10/10)
pnpm build (not run)
Added or updated high-quality tests that would catch regressions, or explained why tests were not needed
Targeted validation:
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-size-reassertion.test.ts
Released Orca 1.4.130 was also exercised with a live stty size probe, hidden-terminal window resizing, 60 rapid same-worktree tab switches, 40 rapid cross-worktree switches, and a coordinated 60-cycle CLI switch loop while manually alternating the native window width.
AI Review Report
Reviewed the visibility-resume PTY reconciliation flow, including target capture, asynchronous applied-size readback, request coalescing, disposal/rebinding guards, and resize forwarding. The main risk checked was that a second layout change could cause either a stale resize or overlapping reconciliation loops. The implementation keeps at most one read in flight, reuses the existing pending-pass mechanism, and forwards only after the captured and latest xterm grids match. The regression test verifies that the stale target is not sent and that the latest target is forwarded once.
Cross-platform review covered macOS, Linux, and Windows. This change uses existing renderer-side terminal dimensions and promise scheduling only; it adds no shortcuts, labels, file paths, shell behavior, or Electron platform APIs. Local and app-managed SSH PTYs retain the existing applied-size path and resize suppression rules. remote: runtime PTYs remain excluded by the existing reassertion gate because their viewport transport does not use pty:getSize; that path is unchanged. Mobile-owned/suppressed PTYs, PTY rebinding, and disposal checks are also unchanged.
Agent and integration compatibility is provider-neutral because the fix operates below individual CLI agents and git providers. Performance risk is limited to one synchronous dimension read after each applied-size response and one coalesced follow-up pass only when the grid changed during the read. No additional code changes were needed after review.
Security Audit
No new input handling, command execution, filesystem/path access, authentication, secrets, dependencies, IPC channels, or network behavior were introduced. The code reads existing in-memory xterm dimensions and uses the existing authenticated PTY size read/resize paths. The new guard reduces the chance of sending an obsolete resize and does not broaden which PTYs are eligible for resizing. No follow-up security work was identified.
Reproduction attempts used released Orca 1.4.130 on macOS 26.5.1 (25F80). The PTY followed observed widths including 179, 38, 103, and 116 columns without remaining stale.
Because [Bug] Terminal UI breakage on switching #7951 reports local and remote-server sessions, confirmation from the affected setup is still needed, especially for the separate remote: runtime viewport path.
The forwardIfDrifted function in pty-size-reassertion.ts now re-reads the terminal's current dimensions before deciding whether to forward the originally observed target size back to the PTY. If the re-measured dimensions differ from the original target, forwarding is skipped and a pending flag is set for a later re-run, instead of forwarding potentially stale dimensions. Corresponding test coverage was updated to reflect the additional dimension re-measurement call, and a new test was added verifying that only the latest dimensions are forwarded when xterm dimensions change while an applied-size read is still in flight.
Comment @coderabbitai help to get the list of available commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Proposes a potential fix for the terminal UI breakage reported in #7951. When a hidden terminal becomes visible, the PTY size reassertion captures xterm dimensions and asynchronously reads the size applied to the PTY. A reveal-time fit can change xterm while that read is in flight; the old callback can then resize the PTY back to the pre-reveal grid, matching the report that affected sessions remain at
80x24or an extremely narrow size until a manual window resize repairs them.This change re-measures xterm after the applied-size read. If the visible grid changed, it suppresses the stale resize and queues a fresh reconciliation pass against the latest dimensions. A regression test covers a reveal-time change from
80x24to145x78and verifies that the stale80x24target is never forwarded.Screenshots
No visual change.
Testing
pnpm lint(not run end-to-end; targeted oxlint passed)pnpm typecheck(not run end-to-end;pnpm run typecheck:webpassed)pnpm test(not run end-to-end; focused test file passed 10/10)pnpm build(not run)Targeted validation:
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-size-reassertion.test.tspnpm exec oxlint src/renderer/src/components/terminal-pane/pty-size-reassertion.ts src/renderer/src/components/terminal-pane/pty-size-reassertion.test.tspnpm exec oxfmt --check src/renderer/src/components/terminal-pane/pty-size-reassertion.ts src/renderer/src/components/terminal-pane/pty-size-reassertion.test.tspnpm run typecheck:webpnpm run check:max-lines-ratchetgit diff --checkReleased Orca 1.4.130 was also exercised with a live
stty sizeprobe, hidden-terminal window resizing, 60 rapid same-worktree tab switches, 40 rapid cross-worktree switches, and a coordinated 60-cycle CLI switch loop while manually alternating the native window width.AI Review Report
Reviewed the visibility-resume PTY reconciliation flow, including target capture, asynchronous applied-size readback, request coalescing, disposal/rebinding guards, and resize forwarding. The main risk checked was that a second layout change could cause either a stale resize or overlapping reconciliation loops. The implementation keeps at most one read in flight, reuses the existing pending-pass mechanism, and forwards only after the captured and latest xterm grids match. The regression test verifies that the stale target is not sent and that the latest target is forwarded once.
Cross-platform review covered macOS, Linux, and Windows. This change uses existing renderer-side terminal dimensions and promise scheduling only; it adds no shortcuts, labels, file paths, shell behavior, or Electron platform APIs. Local and app-managed SSH PTYs retain the existing applied-size path and resize suppression rules.
remote:runtime PTYs remain excluded by the existing reassertion gate because their viewport transport does not usepty:getSize; that path is unchanged. Mobile-owned/suppressed PTYs, PTY rebinding, and disposal checks are also unchanged.Agent and integration compatibility is provider-neutral because the fix operates below individual CLI agents and git providers. Performance risk is limited to one synchronous dimension read after each applied-size response and one coalesced follow-up pass only when the grid changed during the read. No additional code changes were needed after review.
Security Audit
No new input handling, command execution, filesystem/path access, authentication, secrets, dependencies, IPC channels, or network behavior were introduced. The code reads existing in-memory xterm dimensions and uses the existing authenticated PTY size read/resize paths. The new guard reduces the chance of sending an obsolete resize and does not broaden which PTYs are eligible for resizing. No follow-up security work was identified.
Notes
179,38,103, and116columns without remaining stale.remote:runtime viewport path.