Skip to content

fix(floating-workspace): keep file links from blanking the main window - #26655

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/fix-floating-file-link
Oct 9, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/fix-floating-file-link

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Cmd+clicking an HTML file path in the floating workspace opened the file correctly there, but blanked the main window and removed its sidebar selection. The file route also selected the floating workspace as the main workspace. That previously ineffective call started working when #22302 made the floating workspace resolvable like other workspaces.

Opening a file link now keeps the file in the floating panel and leaves the main window's workspace, chat, and source-control panel selected.

What Changed

Shared workspace activation reveals the floating panel through its existing reveal action before any main-window selection or navigation-history changes. Browser and editor file routes therefore target the panel that owns them.

Floating editor links also retain their panel when a project already has that file open. The editor loader preserves that placement for absolute paths instead of moving the tab into the project. Terminal modifier clicks, plain-click file actions, and native-chat file links share this route. HTTP links already preserve the main selection.

Why

Workspace resolution answers where files live; it should not determine which window owns selection. Routing activation to the owning panel prevents the selection change at its source, without restoring selection after it has already moved. Ordinary project and folder-workspace navigation retains its existing routing.

Linked Issue

Brennan's installed-app report and recording, October 8, 2026. No separate issue supplied.

Visual Proof

Pending live QA. A separate driver will attach before/after CDP screenshots from a hidden, isolated Electron rig. No Electron app was launched for this patch.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

134 tests pass across ten named suites, including floating HTML/editor selection, an active folder or SSH workspace, editor loading, file actions, ordinary workspace-root navigation, SSH/runtime file opening, HTTP routing, and native-chat file clicks. Six selection regression checks and the new editor-loader check fail against the original code and pass after the fix. The regression uses the real store and activation code; filesystem and tab-creation boundaries are stubbed.

tc-gate pnpm tc:web passes. No main-process code changed. Local static checks find an inherited max-lines error at src/main/native-chat/agent-session-wire/structured-agent-session-host.ts:368; that file is byte-for-byte identical to the branch's origin/main base. The other 21 of 22 local static checks pass, including changed-code quality, design-system enforcement, localization, and type-aware code quality. Hosted CI is red on the same inherited lint error: run 37832085254. Its final verification job fails because static analysis failed. Repository guards and the separate line-count check pass; hosted tests and downstream builds were skipped. The downloaded failure logs contain no failure caused by this patch.

Review

Self-reviewed the file provider, modifier fallback, plain-click actions, HTML/browser route, editor ownership/loading, native-chat route, and HTTP route. Rendered behavior, real SSH execution, and Windows/Linux execution remain pending live QA.

Agent skill upstream boundary

  • Not applicable; no upstream skill source or fixtures changed.

Notes

No new UI text, persisted fields, filesystem permissions, remote messages, or Git commands. SSH file ownership and remote HTML preview routing remain in the existing host-aware paths. Clicking a workspace-root link still explicitly switches workspaces; this fix concerns opening files in the floating panel.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after screenshots attached (pending separate live QA)
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • All repository checks pass (inherited lint failure above; hosted CI inherits the same failure)

Author: @BrennanKB5

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Visual Proof: live UI pass, main vs this PR

The bug: Cmd+clicking a file path in the floating workspace panel's terminal did open the file inside the floating panel, but it also blanked the main window. The main window lost its workspace, its center tabs and its right panel, and the sidebar row was deselected.

After this PR: the file still opens inside the floating panel, and the main window stays exactly as it was.

I checked both sides in hidden, isolated builds: main at this PR's merge-base (04ac6d6cb24) and this PR (bfe761a63da). Each time, the main window had a workspace selected with a terminal in the center and Source Control open on the right. The floating terminal printed an HTML path and a .md:5:1 path, and each path was Cmd+clicked through the real terminal link.

main (before) this PR (after)
Setup 26655-main26655-before.png 26655-pr26655-before.png
Cmd+click the .html path 26655-main26655-D-html.png 26655-pr26655-D-html.png
Cmd+click the .md:5:1 path 26655-main26655-E-markdown.png 26655-pr26655-E-markdown.png
  • main: the HTML opens in the floating panel, but the main window goes blank and the workspace switches to the floating workspace. The markdown click opens the editor at line 5 in the floating panel, and the main window stays blank.
  • This PR: both files open in the floating panel. The main window keeps the same selected workspace, active tab, Source Control panel and sidebar selection; no field of the main window's selection changed.

Not checked live: the plain-click "Open file" action, links in native chat, folder and SSH workspaces as the main selection, the outside-floating-root file case, and Windows/Linux.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Ready summary

  • Problem: Cmd+clicking a file path in the floating workspace opened the file there, but also blanked the main window and removed its sidebar selection. feat(floating-workspace): render the floating panel through the shared workspace surface #22302 made the floating workspace resolvable like other workspaces, so the file route's "activate this workspace" step started selecting it in the main window, which can't display it.
  • User-facing change: files opened from the floating panel stay in the panel, and the main window keeps its workspace, panels and sidebar selection.
  • Fix: workspace activation reveals the floating panel instead of changing the main window's selection. Two file routes also no longer move a floating file into a project that contains the same path.
  • Verified:
    • Live UI pass on a hidden, isolated build, main vs this PR, on an .html and a .md:line:col path: main reproduces the blank window; this PR doesn't. Screenshots are in the comment above.
    • 134 named tests and the web typecheck pass.
    • I reviewed the production diff.
  • CI: the only red check is static analysis and typecheck, from a max-lines error in structured-agent-session-host.ts. This PR doesn't touch that file, and main's own latest run fails the same way, so it's inherited.
  • Not verified: plain-click and HTTP links, native-chat links, an SSH or folder workspace as the main selection, and Windows/Linux.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 9, 2026 03:31
@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 81a85ce2-4c7a-4102-af4e-388c691f4018
📥 Commits

Reviewing files that changed from the base of the PR and between 04ac6d6 and bfe761a.

📒 Files selected for processing (5)
  • src/renderer/src/components/editor/useEditorPanelFileContentLoader.ts
  • src/renderer/src/components/editor/useEditorPanelFloatingTabContentState.test.tsx
  • src/renderer/src/components/terminal-pane/floating-file-link-selection.test.ts
  • src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts
  • src/renderer/src/lib/worktree-activation.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Floating workspace IDs now bypass workspace-file route lookup for restored absolute-path tabs and sibling-worktree collision routing for detected terminal files. Worktree activation reveals the floating workspace panel and returns no primary tab. Added tests cover file and browser link behavior, selection preservation, and panel reveal.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to bfe76

No actionable issue is established for this change. It is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary fix: preventing floating-workspace file links from blanking or changing the main window.
Description check Passed The description is detailed, on-topic, and follows the required template. It explains the user impact, implementation, rationale, testing, known CI limitation, and checklist status. The actual issue l…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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.

@brennanb2025
brennanb2025 merged commit 13c9f1f into main Oct 9, 2026
45 of 49 checks passed
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