Skip to content

fix(editor): open files in the focused pane when it is a browser (#6891) - #8014

Merged
nwparker merged 1 commit into
stablyai:mainfrom
westkite1201:fix/file-open-focused-browser-pane-6891
Jul 24, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
westkite1201:fix/file-open-focused-browser-pane-6891

Conversation

@westkite1201

@westkite1201 westkite1201 commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Opening a file while a browser (or simulator) split pane is focused now routes the file into that focused pane instead of stealing an unrelated, stale editor pane.

ELI5

If you were looking at a browser panel and opened a file, the file used to pop up in some other editor panel off to the side. Now it opens right where you're looking.

Root cause & fix

resolveEditorOpenTargetGroupId deferred to an existing editor pane whenever the focused group's active tab was any editor-family tab or when there was no active tab (if (!activeTab || isEditorTabContentType(activeTab.contentType))). That "reuse an existing editor pane" path is only meant for a focused agent terminal, so a focused non-terminal, non-editor pane (browser/simulator) fell through and the file was routed to a stale editor pane. The fix narrows the condition to defer only when the focused pane is a terminal (if (!activeTab || activeTab.contentType !== 'terminal')), so browser and simulator panes now open the file in the focused group.

Evidence

Validated & rebased onto latest main during a bug-bash triage on 2026-07-23. Clean rebase onto origin/main (base 7ab601487c, head 6f74ea9ef6).

  • Test file: src/renderer/src/store/slices/editor.test.ts (npx vitest run --config config/vitest.config.ts).
  • On branch (fix present): 183 passed (183).
  • Fix reverted to origin/main, test kept: 1 failed | 182 passed — the regression test opens implicit files in a focused browser split group instead of stealing an editor pane (#6891) fails.
  • Lint clean: npx oxlint src/renderer/src/store/slices/editor.ts reports no warnings/errors.
On branch:   Test Files 1 passed (1) ; Tests 183 passed (183)
Fix reverted: Tests 1 failed | 182 passed (183)
  FAIL: opens implicit files in a focused browser split group instead of
        stealing an editor pane (#6891)
  AssertionError: expected '<editor-group-id>' to be '<browser-group-id>'

Trade-offs

None — pure fix.

Regression risk

Zero-regression by construction: the terminal-focused case is byte-identical (still defers to an existing editor pane). The only changed path is focused non-terminal, non-editor panes (browser/simulator), which now route to the focused group — the intended behavior, proven by the passing regression test.

Credit to original author @westkite1201 (SeoYeonKim). Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updated resolveEditorOpenTargetGroupId so focused non-terminal tabs reuse the active group, while focused terminal tabs retain the existing alternate-pane logic. Added a regression test covering implicit file opening when an Agent | Browser split has its browser pane focused.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description covers summary, root cause, and evidence, but it omits required template sections like screenshots, testing checklist, AI review, security, and notes. Add the missing template sections: Screenshots/No visual change, Testing checklist, AI Review Report with cross-platform checks, Security Audit, and Notes.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The code and regression test match #6891 by keeping file opens in the focused browser pane instead of rerouting to an editor pane.
Out of Scope Changes check ✅ Passed The changes stay within the bug fix and regression test, with no obvious unrelated edits.
Title check ✅ Passed Title matches the main fix: opening files in the focused browser pane instead of an unrelated editor pane.

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.

@brennanb2025

Copy link
Copy Markdown
Contributor

Taking a look!

resolveEditorOpenTargetGroupId only kept a file in the focused group when
its active tab was an editor/diff; terminal, browser, and simulator panes
all fell through to the "reuse an existing editor pane" path. That path is
only meant for a focused agent terminal, so focusing a browser split and
opening a file stole it into a stale editor pane instead of the focused
group (stablyai#6891).

Constraint: focused agent terminals still defer to an existing editor pane.
Rejected: match every non-terminal to the editor case implicitly | explicit contentType check keeps the intent
Confidence: high
Scope-risk: narrow
Tested: vitest editor.test.ts (166 passed, incl. new stablyai#6891 regression); typecheck:web; oxlint
Not-tested: packaged desktop e2e / live build
@nwparker
nwparker force-pushed the fix/file-open-focused-browser-pane-6891 branch from 6f74ea9 to 6cc453c Compare July 23, 2026 11:48
@nwparker
nwparker merged commit 933cee6 into stablyai:main Jul 24, 2026
@nwparker

Copy link
Copy Markdown
Contributor

Thanks so much for this, @westkite1201 — open files in the focused pane when it is a browser (#6891). Reviewed, rebased on latest main, and merged. Really appreciate the contribution! 🙏

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.

3 participants