Skip to content

fix(sftp): keep browse sessions when switching side-panel tools - #2884

Open
netcatty-bot wants to merge 1 commit into
mainfrom
cursor/issue-2882-31452615583
Open

fix(sftp): keep browse sessions when switching side-panel tools#2884
netcatty-bot wants to merge 1 commit into
mainfrom
cursor/issue-2882-31452615583

Conversation

@netcatty-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Terminal side-panel SFTP no longer soft-closes (parks) browse channels when you switch to History / System / other tools while the panel chrome stays open.
  • Directory listing cache and live SFTP sessions stay put, so switching back to File Transfer does not force reconnect + full reload.
  • Closing the side panel still parks browse sessions (FileZilla-style), unless an editor tab or external-edit temp still needs the channel.
  • Added lifecycle unit coverage for “panel open on another tool” vs “panel closed” park decisions, plus wiring assertions in the side-panel slot contract test.

Why

Opening File Transfer, then Logs (or another side-panel tool), then switching back remounted the list slowly and sometimes left a blank list. The owner React tree was already kept mounted across tool switches, but isVisible=false was treated as “non-interactive,” which parked browse SFTP sessions and cleared the listing cache. Restore then had to reconnect and re-list — expensive, and race-prone.

Changes

  • isBrowseSessionInteractive gains ownerPanelOpen: keep browse warm while the terminal side panel is still open for that tab.
  • SidePanelSftpSlot passes ownerPanelOpen={sidePanelOpenTabs.has(tabId)} into SftpSidePanel.
  • Comments on main SftpView / useSftpState updated so parking is described as panel-close behavior, not every hide of the SFTP tool surface.

Testing

  • node --test --import tsx application/state/sftp/browseSessionLifecycle.test.ts
  • node --test --import tsx components/terminalLayer/sftpPanelLifecycle.test.ts
  • node --test --import tsx application/state/editorTabSave.test.ts (promoted-editor retain path still green)
  • Manual (unverified here): connect → open File Transfer → open Logs / System → switch back; list should appear immediately without reconnect. Close the side panel with no transfers and confirm browse still parks.

Fixes #2882

Automation

  • Automated implement pass
  • Review gate: @codex review (own/bot PRs only)
  • Draft until Codex reports clean findings

@netcatty-bot netcatty-bot added automation:bot-pr PR created or owned by Cursor automation automation:codex-loop Own/bot PR waiting on Codex review↔fix loop triage Touched by Cursor automation labels Aug 11, 2026
@binaricat

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: ac3993b789

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@netcatty-bot
netcatty-bot marked this pull request as ready for review August 11, 2026 02:51
@netcatty-bot netcatty-bot added automation:codex-clean Last Codex review reported clean and removed automation:codex-loop Own/bot PR waiting on Codex review↔fix loop labels Aug 11, 2026
@netcatty-bot

Copy link
Copy Markdown
Collaborator Author

Codex reported no major issues. This PR is marked ready for human review/merge.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac3993b789

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

tabId={tabId}
ctx={ctx}
isVisible={isToolVisible(tabId, 'sftp')}
ownerPanelOpen={openTabs.has(tabId)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep parked SFTP closed when reopening other tools

When an SFTP side panel was closed but kept mounted because a transfer or external edit was still active, the browse sessions either park after the activity finishes or should stay parked while the SFTP UI remains closed. With ownerPanelOpen driven by openTabs.has(tabId), opening History/System for that tab flips the hidden SFTP owner back to interactive even though SFTP is not visible, so useSftpState skips parking after the retained work completes (or restores already-parked browse sessions). This defeats the close-panel lifecycle and can keep/reopen SSH/SFTP browse connections just because a different side-panel tool is open; this should be gated on an actual SFTP tool switch from an open panel rather than any open side-panel tab.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation:bot-pr PR created or owned by Cursor automation automation:codex-clean Last Codex review reported clean triage Touched by Cursor automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 文件传输模块,文件列表加载很慢

2 participants