Skip to content

perf(ssh): a parked web-mirror reveal reads its pane alongside the activation - #29472

Merged
nwparker merged 2 commits into
mainfrom
nwparker/reveal-resolve-pane-parallel
Oct 16, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/reveal-resolve-pane-parallel

Conversation

@nwparker

@nwparker nwparker commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​179 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​179
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​43 $\color{#cf222e}{\Huge{\mathbf{−}}}$​20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23

ELI5

When you switch back to a remote terminal that Orca had put to sleep, Orca asks the host two questions before it reconnects: "wake this tab" and "which terminal is in this pane?" It used to wait for the first answer before asking the second. The second question doesn't need the first answer, so now both go out together. That saves one network round trip on every such reveal.

What Changed

  • Before: on a parked web-mirror reveal, terminal.resolvePane was sent only after session.tabs.activate answered. Subscribe waited behind both, one after the other. In the repro trace at 150 ms latency, this serial step cost about 220 ms.
  • After: resolvePane goes out together with the activation, and the reveal awaits both before subscribing. On the host, resolvePane is a synchronous lookup keyed only by the pane, with no side effects, so it doesn't depend on the activation.
  • When the early answer is re-read after the activation:
    • it names a different handle, or errored. A pending surface only materializes through the activation.
    • it lacks the incarnation id the activation learned, or carries a different one. Without the re-read, the early answer would erase that id, and remote foreground evidence would be rejected.
  • Unchanged: a host that answers method_not_found still turns the lookup off. An answer that has no pane now counts as unresolved instead of throwing.

The change is client-only, with no wire change, so it's safe with older hosts.

Why

This is the smallest change that removes the serial round trip. The alternatives were to fold resolvePane into the activation response, or to drop it. Both would need a host change and capability negotiation, and they'd lose the metadata check that resolvePane provides. Reading early and re-reading only on a mismatch keeps the result identical to the old order in every case where the early answer could be stale.

Linked Issue

N/A. This came from the parked-reveal perf trace (follow-up to #29269 / #29344).

Visual Proof

N/A. Nothing changes visually; the reveal starts one round trip sooner.

Testing

  • New remote-runtime-pty-transport-mirror-resolve-overlap.test.ts with 3 cases, all failing without the change:

    • the pane read goes out before the activation answers, and is read once
    • a pane is re-read after the activation materializes a different handle
    • a pane is re-read when the early answer predates the incarnation the activation learned
  • 56 remote transport test files (440 tests), run single-worker. pnpm tc:web and check:code-quality:changed pass.

  • Codex review (gpt-6.1-sol, high). Round 1 found the incarnation race, now fixed and covered by a test. Round 2 was clean.

  • Real-host A/B vs main a8f2c65 (same freshly built orcad): 150 ms netem — Subscribe 320–351 ms vs 371–509; settled 553–607 vs 585–751 (seq), 493–547 vs 599–681 (TUI). openclaw — Subscribe 49–73 vs 59–98; settled 81–167 vs 100–212. resolvePane fired once per reveal on all 12 reveals.

  • I manually tested these changes locally

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

Review

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

SSH and remote: client-side ordering only, with no change to what the host publishes. Cross-platform: no platform-specific code.

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)

@coderabbitai

coderabbitai Bot commented Oct 16, 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: cd42e469-735c-40ac-a008-133ac42afb10
📥 Commits

Reviewing files that changed from the base of the PR and between a8f2c65 and e893e21.

📒 Files selected for processing: 2
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-mirror-resolve-overlap.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.

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