Skip to content

fix(ssh): a fast remote folder listing no longer shows a false error - #26940

Merged
OrcaWin merged 1 commit into
mainfrom
nwparker/reproducible-ssh-browse-close-10-09
Oct 11, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
nwparker/reproducible-ssh-browse-close-10-09

Conversation

@nwparker

@nwparker nwparker commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you add a remote project over SSH and browse folders on the host, a fast host could make the folder picker show an error even though the listing worked. Orca now reads the host's exit status from the point where the connection closes, which always carries it, so a successful listing shows its folders.

What Changed

  • Before: on a fast host, the folder picker sometimes showed "Remote listing failed (channel closed without exit status)" and needlessly retried the listing as a Windows host.
  • After: the listing appears. A real failure still fails, and a channel that closes with no status at all is still treated as a failure.
  • Mechanism: the SSH library can deliver "command finished, exit 0" in the same network read as "command started". That exit event fires before Orca's folder-listing code has started listening for it, so Orca saw no status. The library repeats the status on the later close event. The listing code now uses that close status when it never saw the exit event. An exit status it did see still wins.

Why

Reading the status the transport already repeats on close is the smallest fix and needs no replay, polling, or wire change. The general SSH command runner already reads the close status, so this brings folder browsing in line with it.

The original PR also changed the plain SSH shell provider, which has since been removed from main, and the relay startup sentinel, which only affects how a refusal from the legacy relay path is labeled after the relay was deleted. Both were dropped to keep this focused.

Linked Issue

Fixes #8956

Adapted from @suharvest's #26403; the commit credits them as co-author.

Visual Proof

Earlier hidden-renderer capture of the real picker against a loopback SSH host (before: error; after: entries):

Before
After

Testing

  • I manually tested these changes locally (earlier revision of the same handler change, hidden Electron renderer, loopback ssh2 host)
  • Automated tests added/updated: src/main/ipc/ssh-browse.test.ts gains two cases, an exit that fires before the channel is handed back, and an observed exit status that must win over the close status. Both fail on current main and pass with this change.

pnpm tc:node, oxlint, pnpm run check:code-quality:changed, and pnpm lint pass.

Review

Own review plus an independent read-only reviewer; P0/P1 only.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

SSH only; no wire change. Works the same for the ssh2 and system OpenSSH transports (both pass the status on close) and for POSIX and Windows hosts. Folder workspaces and git worktrees use the same picker.

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)

@nwparker
nwparker marked this pull request as ready for review October 9, 2026 19:11
@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: b6c675a8-78fc-4105-8479-4b234b493241


📥 Commits

Reviewing files that changed from the base of the PR and between c5306bc and cec7916.



📒 Files selected for processing (2)
  • src/main/ipc/ssh-browse.test.ts
  • src/main/ssh/ssh-remote-directory-browse.ts


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




📝 Walkthrough
📝 Walkthrough

Walkthrough

The SSH browse command now records whether it received an exit status. A numeric status from the close event is used only when no exit event supplied a status. New tests cover a successful exit before listener attachment and a nonzero exit followed by a successful close.



Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to cec79

The reviewed change preserves browse completion status in the tested event orderings. No actionable merge-blocking risk remains after normal checks.

Pre-merge checks | Passed 4 | Failed 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 4 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Issue #8956 requires reliable remote directory listing from Windows to a Linux host. runBrowseCommand now uses the close status when no exit event was observed. A successful fast listing therefo…
Out of Scope Changes check Passed The changes are limited to src/main/ssh/ssh-remote-directory-browse.ts and its focused test file. The implementation and tests directly support the SSH directory-listing completion-status fix. No un…
Title check Passed The title clearly and concisely identifies the SSH folder-listing bug fix, which matches the main change.
Description check Passed The description is mostly complete. It explains the user impact, mechanism, rationale, linked issue, visual proof, testing, scope, and review status. Some checklist items and command results are not e…

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR



  • 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.

@OrcaWin

OrcaWin commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

Status note after the relay removal (#27214, #27215): the plain-shell SSH provider no longer exists, and directory browsing moved to src/main/ssh/ssh-remote-directory-browse.ts, which still ignores the status close delivers. The waitForSentinel change now only affects legacy-relay migration checks. The browse fix still applies (overlaps #26403); the rest needs trimming on rebase.

…ailure

ssh2 can deliver the exec ack and the exit status in one chunk, so 'exit'
fires before the browse handler subscribes. Fall back to the status that
'close' repeats when no exit was observed.

Co-authored-by: suharvest <[email protected]>
@OrcaWin
OrcaWin force-pushed the nwparker/reproducible-ssh-browse-close-10-09 branch from c5306bc to cec7916 Compare October 11, 2026 06:57
@OrcaWin OrcaWin changed the title Preserve SSH completion status for fast listings and shells fix(ssh): a fast remote folder listing no longer shows a false error Oct 11, 2026
@OrcaWin
OrcaWin merged commit e3be586 into main Oct 11, 2026
46 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.

[Bug]: Fail to list remote dirs

2 participants