Skip to content

fix(remote): preserve the exact preview source group - #16129

Open
brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/audit-15716
Open

brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/audit-15716

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​186 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​178
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​106 $\color{#cf222e}{\Huge{\mathbf{−}}}$​64 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42

Important

User-visible defect: in a workspace with three or more split groups, focusing the still-empty remote HTML preview pane could return focus to an unrelated editor group instead of the editor that opened the preview.

Author: @BrennanKB5

What changed

  • Record the exact source group and pairing owner with a pending client-side browser placement.
  • Preserve that focus intent through provisional-to-host page ID remapping and overlapping preview requests.
  • Reconcile an empty pending preview only to its recorded source group, including local-to-mirrored tab ID replacement.
  • Keep cleanup ownership independent so stale placements can finish cleanup without affecting a re-paired client's focus.

Why

Follow-up to #15716. That merged fix correctly prevents an unfocused paired preview from activating its new split, but its defensive snapshot fallback searches every other group and selects the first editor-like tab. Group creation order is not focus intent, so a three-group layout can visibly jump to the wrong editor.

This is a focused correctness fix, not a style cleanup. No RPC field, stream opcode, host publication, SSH behavior, folder-workspace assumption, path handling, or platform shortcut changes.

Non-vacuous regression proof

The new three-group acceptance state failed on current origin/main before the production fix:

- "activeGroupId": "client-editor-group",
- "activeTabId": "local-html-editor",
+ "activeGroupId": "unrelated-editor-group",
+ "activeTabId": "unrelated-html-editor",

After the fix, the source editor group remains active.

Validation

  • pnpm typecheck
  • node config/scripts/check-changed-code-quality.mjs
  • node config/scripts/check-react-doctor-changed.mjs
  • 262 affected Vitest tests across 30 files
  • Electron paired-runtime e2e: tests/e2e/paired-remote-html-browser-focus.spec.ts — 1 passed; the rendered source editor remained active until the remote browser pane was clicked

Remote wire compatibility

No wire change. The new source/owner metadata exists only in renderer-local pending placement state; the host receives the same browser.tabCreate request as before.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 5 minutes.

View limit details

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

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 530f6973-c885-4d18-a6ca-3121a9abbb9e

📥 Commits

Reviewing files that changed from the base of the PR and between d1127b9 and d2575ae.

📒 Files selected for processing (9)
  • src/renderer/src/lib/file-preview.test.ts
  • src/renderer/src/lib/file-preview.ts
  • src/renderer/src/runtime/web-runtime-session.ts
  • src/renderer/src/runtime/web-session-browser-placement.test.ts
  • src/renderer/src/runtime/web-session-browser-placement.ts
  • src/renderer/src/runtime/web-session-focus-intent-visible-tab.test.ts
  • src/renderer/src/runtime/web-session-focus-intent.ts
  • src/renderer/src/runtime/web-session-tabs-sync-html-preview-focus.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts

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.

This branch has not been deployed

No deployments
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