Skip to content

fix(explorer): reveal local worktrees even when a remote runtime is active - #16559

Closed
innocarpe wants to merge 0 commit into
stablyai:mainfrom
innocarpe:fix/reveal-local-worktree-file-manager
Closed

innocarpe wants to merge 0 commit into
stablyai:mainfrom
innocarpe:fix/reveal-local-worktree-file-manager

Conversation

@innocarpe

Copy link
Copy Markdown
Contributor

Description

Reveal in Finder / Open in file manager was treating local worktrees as remote after a paired host had been used, because the guard read the globally focused runtime instead of the target worktree host.
File Explorer, worktree Open in, and the source-control reveal path now scope that check to the worktree's own runtime owner and connectionId.

Focused fix

  • In scope: local OS reveal/open uses the target worktree host, not settings.activeRuntimeEnvironmentId.
  • Out of scope: remote-path browsing, pairing, iCloud dataless files, dead worktree cleanup.

Preserves

  • SSH and runtime-owned paths still cannot open in the local OS.
  • Editor tab local-open already used settingsForRuntimeOwner; this matches that contract.

Evidence

  • Test: pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/local-path-open-guard.test.ts src/renderer/src/components/sidebar/WorktreeOpenInMenu.test.tsx src/renderer/src/components/right-sidebar/FileExplorerRow.actions.test.tsx src/renderer/src/components/right-sidebar/FileExplorerToolbar.test.tsx src/renderer/src/components/right-sidebar/source-control-entry-context-menu.test.tsx
  • Result: 54 passed
  • Regression: global activeRuntimeEnvironmentId set + local worktree + no connectionId is not blocked.

User-regression-tradeoffs

None for local worktrees. Remote/SSH reveal remains blocked.

Fixes #16539

@innocarpe

Copy link
Copy Markdown
Contributor Author

Claiming #16539: Reveal in Finder now uses the target worktree host instead of the globally focused runtime, so a local worktree stays local after a paired remote session.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e631d0c0-ee20-45cd-b8cb-d47bbbe77468

📥 Commits

Reviewing files that changed from the base of the PR and between 5dd1a6e80f705d302636a7efb0c18e6d2cf4bdd7 and 0581a52.

📒 Files selected for processing (2)
  • src/renderer/src/components/right-sidebar/FileExplorerRow.actions.test.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-row-reveal.ts

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


📝 Walkthrough

Walkthrough

The change adds runtime-owner-aware local-path blocking. File-explorer, sidebar, and source-control actions resolve each worktree’s explicit runtime environment and pass it through availability and execution paths. File-explorer reveal checks use a centralized helper. Tests cover local, remote-owned, and SSH-backed worktrees, including behavior during globally active remote runtimes.

Merge Risk: ⚪ Minimal · up to 0581a

The change makes local worktree reveal actions use the target worktree's runtime ownership while preserving blocked behavior for remote and SSH paths; targeted regression tests pass, and no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the bug, scope, implementation behavior, linked issue, regression test, and test result. However, it omits several required template sections, including Visual Proof, … Use the repository template headings. Add Visual Proof or write N/A with a reason, complete the Testing section with manual-test and platform details, complete the Agent skill boundary and Checklist sections, and address AI Disclosure, Re…
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 14 functions across 13 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary fix: allowing local worktree reveal actions while a remote runtime is active.
Linked Issues check ✅ Passed The changes satisfy issue #16539 by using the target worktree runtime owner and connection context for reveal and open-in checks. Local worktrees remain available when a remote runtime is globally act…
Out of Scope Changes check ✅ Passed The changed production files and tests support the stated fix across File Explorer, worktree Open in, and source-control reveal paths. No unrelated code changes are identified.
Full details: Description check

Explanation

The description clearly explains the bug, scope, implementation behavior, linked issue, regression test, and test result. However, it omits several required template sections, including Visual Proof, Testing checklist details, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist.

Resolution

Use the repository template headings. Add Visual Proof or write N/A with a reason, complete the Testing section with manual-test and platform details, complete the Agent skill boundary and Checklist sections, and address AI Disclosure, Review, and Notes as applicable.

Full details: Linked Issues check

Explanation

The changes satisfy issue #16539 by using the target worktree runtime owner and connection context for reveal and open-in checks. Local worktrees remain available when a remote runtime is globally active, while remote, SSH-backed, and unresolved worktrees remain blocked. The stale worktree behavior is explicitly outside this fix.

  • Fix all pre-merge checks with AI

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 657fa5d0-17a0-4cef-807a-4a993a5c41fa

📥 Commits

Reviewing files that changed from the base of the PR and between f72dcb9 and 5dd1a6e80f705d302636a7efb0c18e6d2cf4bdd7.

📒 Files selected for processing (13)
  • src/renderer/src/components/right-sidebar/FileExplorer.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerRow.actions.test.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerToolbar.test.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerToolbar.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-row-context-menu.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-row-reveal.ts
  • src/renderer/src/components/right-sidebar/source-control-entry-context-menu.test.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/entry-context-menu.tsx
  • src/renderer/src/components/sidebar/WorktreeContextMenuView.tsx
  • src/renderer/src/components/sidebar/WorktreeOpenInMenu.test.tsx
  • src/renderer/src/components/sidebar/WorktreeOpenInMenu.tsx
  • src/renderer/src/lib/local-path-open-guard.test.ts
  • src/renderer/src/lib/local-path-open-guard.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@innocarpe
innocarpe force-pushed the fix/reveal-local-worktree-file-manager branch from 5dd1a6e to 0581a52 Compare August 26, 2026 09:17
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (0581a5220)

Address CodeRabbit: reveal now uses getConnectionIdFromState, so a detected SSH worktree missing from worktreesByRepo cannot fall through to local openPath. Unresolved owners fail closed.

This branch was previously deployed

1 inactive deployment
adhoc-mac-build — 6568e887 Deployed Oct 29, 2026 by nwparker via build-hourly-win / build-win #2093
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]: 'Reveal in Finder' misidentifies local worktree as remote project after switching worktrees

2 participants