Skip to content

fix(remote-terminal): draw the host's saved screen when a reattached pane's first image is blank - #29261

Merged
nwparker merged 3 commits into
mainfrom
nwparker/remote-blank-pane
Oct 16, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/remote-blank-pane

Conversation

@nwparker

@nwparker nwparker commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​188 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​188
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8

ELI5

Sometimes a terminal on a remote Orca machine opens as a blank pane with just a cursor, even though the machine still has the full screen. This happens most with agent sessions that have been sitting idle for a long time. The pane was waiting for the agent to print something new, and an idle agent never does. Now, if the first picture of the screen the pane receives is blank, the pane asks the remote machine for its saved copy and draws that.

What Changed

Before: you click an existing remote session and see a blank pane with a cursor in the top-left. Resizing, switching tabs and restarting the client don't help, because each reattach takes the same path. Closing the tab and starting a new session is the only way back.

After: the pane draws the screen the remote machine has saved, using the same request the pane already makes after a dropped connection.

Mechanism (remote-runtime-pty-transport.ts, in onSubscribed): when a pane attaches, the remote machine pushes an image of the screen. Three kinds of image left the pane with nothing to draw:

  • an empty image;
  • an image that held only control codes (terminal modes, a cursor move) and no visible text;
  • an image larger than the client's 2 MiB limit, which the client discards on purpose.

In all three cases the pane only asked for the saved screen when it was recovering from a dropped connection, never on a first attach. It now asks whenever the first image had nothing visible. The one exception is a terminal this pane has just created: a brand-new shell has no history, so there is nothing to fetch. The request goes through the existing onStreamRecovered path, so a hidden pane waits until it is shown before drawing.

Why

The remote machine's saved screen is the most complete copy it has. The pushed image comes from whichever copy the machine reaches first, and that copy can be a partial one that holds only the bytes received since the reattach. The reporter of #21208 measured exactly this: the machine sent an empty image for one blank pane, while orca terminal read --screen returned the full frame. Asking for the saved screen when the image is empty fixes this on the client, so it also works with older remote hosts.

Alternatives I considered:

  • Make the remote machine never send a partial image. That has to be fixed in several places on the host and only helps hosts that get updated.
  • A watchdog that waits N seconds and then asks again. That adds a delay and a timer when the cause is already known at attach time.
  • Resend the screen size to force the program to redraw itself (the approach in fix(terminal): recover remote pane geometry and replacement mouse state #19925). That needs a new request field and the program's cooperation, and it doesn't help a pane whose program has exited.

Linked Issue

Related: #18464, #21208, #23884. This fixes the "first image was empty or blank" path behind these reports. I'm not marking them fixed, because none of them comes with a reproduction that shows this was their only cause:

Visual Proof

N/A: the bug needs a long-idle agent on a paired remote host whose host copy is partial, and I can't reproduce that on demand. The new transport tests drive each first-image shape through the real transport and the real frame decoder.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • New remote-runtime-pty-transport-empty-initial-snapshot.test.ts covers both reattach paths (attach with a persisted handle, and connect to an existing terminal). It checks an empty image, a control-code-only image, and an image over the 2 MiB limit, and that each one requests the saved screen. It also checks that an image with visible text and a freshly created terminal make no extra request. With the source change reverted, the empty, control-code-only and over-limit cases fail.

  • pnpm test src/renderer/src/components/terminal-pane src/renderer/src/runtime: everything passed except timeouts. Under a load average above 60, remote-snapshot-alt-screen-host-chain and the type-ahead / pairing-rotation files time out on unmodified main as well, and they pass when the machine is idle.

  • pnpm tc and pnpm run check:code-quality:changed pass.

AI Disclosure

Review

Codex review (gpt-6.1-sol, high effort) on the branch found no issues.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Renderer only. Nothing changes in what the client and the remote machine send each other, so mixed client and host versions keep working.
  • SSH: covers managed-SSH and paired-runtime panes, which both use this transport. Losing contact is still not treated as the program having ended.
  • Cross-platform: no paths, shortcuts or OS calls.
  • Cost: at most one extra snapshot request per reattach, and only when the first image had no visible text.
  • Overlap: fix(remote-terminal): reattach a healthy remote pane promptly after a worktree switch #29210 changes nearby recovery code in the same file but does not touch onSubscribed.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

nwparker and others added 2 commits October 15, 2026 15:05
… replays no image

A remote pane that reattached to an idle long-lived agent and received an
empty (or over-limit) initial snapshot never asked the host again, so it
stayed blank with only a cursor until the agent printed something.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: db90c8bc-a684-4f24-a796-abb8e6e5279b
📥 Commits

Reviewing files that changed from the base of the PR and between 102b267 and 392004d.

📒 Files selected for processing: 2
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-empty-initial-snapshot.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…-pane

# Conflicts:
#	src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant