Skip to content

Keep explorer file watches on the selected remote host - #26616

Merged
OrcaWin merged 1 commit into
mainfrom
nwparker/remote-explorer-selected-host
Oct 9, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
nwparker/remote-explorer-selected-host

Conversation

@nwparker

@nwparker nwparker commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​298 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​298
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​22 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16

ELI5

Two remote machines can have the same folder or worktree ID. The explorer now listens to the machine you selected, so its new files appear and removed files disappear.

What Changed

Before, the selected host could return a correct directory listing and publish a real file event, yet the explorer stayed stale. Its watch-owner snapshot discarded the active workspace and host before calling the existing ownership resolver, so repeated IDs could no longer be resolved to the displayed tree's owner.

The snapshot now preserves those two fields. Existing checks still reject events from another host or a listing owned by the previous selection.

Why

The selected host is already authoritative identity in Orca's shared owner resolver. Passing it through fixes the missing evidence without guessing from global runtime focus or adding another ownership algorithm.

Linked Issue

Found during SSH → Remote consolidation testing; no existing issue.

Visual Proof

Both independently converted Linux hosts publish the same folder ID from separate valid profiles. Each baseline gets the selected host's initial listing, positive file read and actual app event, but omits its new file. Both corrected journeys display the new file and then remove it after an external deletion.

selected-host-explorer-host-a-before.png
selected-host-explorer-host-b-before.png
selected-host-explorer-host-b-after.png
selected-host-explorer-runtime-red.log
selected-host-explorer-runtime-green-final.log
selected-host-explorer-host-a-after.png

Testing

  • Hidden macOS Electron client, two owned Linux Docker SSH hosts and the installed production server template.
  • Checked ownership regressions and dedicated template-building Docker CI routing added.

Untouched Phase 3.5 fails for host A / B in 28.9 / 29.3 s. Final corrected cases pass in 19.9 / 20.0 s (41.6 s total). Each proves the selected host's initial sentinel, excludes the other host's sentinel, receives an actual host-qualified creation event, displays the file and follows its deletion.

Four new folder/worktree ownership regressions fail before the fix; the unrelated-workspace guard already passes. 246 tests / 15 files pass afterward, including existing route, generation, watcher, host ambiguity and CI contracts. Full pnpm tc, pnpm lint, changed quality, standalone React Doctor, fresh E2E build and commit hooks pass.

Combined stack verification: C18–C21 rebased on #26637/#26645 preserves their renderer changes exactly. 547 tests / 49 files, full typecheck/lint, changed quality (including React Doctor/design-system checks), a fresh E2E build and both real-host switch directions pass. CI reruns on the new head; prior green results are not claimed for it.

Review

Stacked on #26645, which is stacked on #26637. Merge #26637 → #26645 first. These exercised startup fixes support the shared real-host CI lane; this PR retains its original focused explorer change. The product change adds two snapshot fields and describes them in its checked owner-state type. The existing Docker-lane contract moved into a separate file to keep its size within the lint limit.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer source or resources copied.

Notes

No server or remote wire change. Runtime coverage is macOS client / Linux SSH hosts; Windows was not exercised. All file writes target disposable owned fixtures. Watch recovery after a server restart and cache invalidation during an in-place host switch are separate concerns.

Checklist

  • Focused change with ELI5, before/after, mechanism and approach explained
  • Both before/after screenshot pairs and runtime logs attached
  • Self-reviewed for correctness, security and performance
  • SSH ownership, folder workspaces, paths and compatibility considered
  • Local lint, typechecks, affected tests and fresh build pass

@nwparker
nwparker force-pushed the nwparker/remote-explorer-selected-host branch from c06c5fb to d097934 Compare October 8, 2026 18:56
@nwparker
nwparker changed the base branch from OrcaWin/phase35 to nwparker/managed-start-reconnect-fence October 8, 2026 18:57
@OrcaWin
OrcaWin force-pushed the nwparker/remote-explorer-selected-host branch from d097934 to e0d99fa Compare October 9, 2026 02:27
@OrcaWin
OrcaWin changed the base branch from nwparker/managed-start-reconnect-fence to nwparker/remote-explorer-watch-recovery October 9, 2026 02:27
@OrcaWin

OrcaWin commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Restacked: this branch is now rebased on current main via #26606 → #26612 (no longer on #26637/#26645). Its CI-routing changes were merged with theirs; the product change is unchanged.

@OrcaWin
OrcaWin force-pushed the nwparker/remote-explorer-watch-recovery branch from bdc7f68 to f092245 Compare October 9, 2026 06:03
@OrcaWin
OrcaWin force-pushed the nwparker/remote-explorer-selected-host branch from e0d99fa to 53d0e31 Compare October 9, 2026 06:04
@OrcaWin
OrcaWin force-pushed the nwparker/remote-explorer-watch-recovery branch from f092245 to 9b2a67c Compare October 9, 2026 06:10
@OrcaWin
OrcaWin force-pushed the nwparker/remote-explorer-selected-host branch from 53d0e31 to 0f6dfc4 Compare October 9, 2026 06:10
@OrcaWin
OrcaWin force-pushed the nwparker/remote-explorer-watch-recovery branch from 9b2a67c to f895e39 Compare October 9, 2026 09:18
@OrcaWin
OrcaWin force-pushed the nwparker/remote-explorer-selected-host branch from 0f6dfc4 to 810c5ef Compare October 9, 2026 09:18
@OrcaWin
OrcaWin force-pushed the nwparker/remote-explorer-watch-recovery branch from bb075c3 to 21737a8 Compare October 9, 2026 11:23
@OrcaWin
OrcaWin changed the base branch from nwparker/remote-explorer-watch-recovery to main October 9, 2026 11:44
@OrcaWin
OrcaWin force-pushed the nwparker/remote-explorer-selected-host branch from 16eb5c0 to 0bb7200 Compare October 9, 2026 11:44
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Walkthrough

Explorer watch-owner resolution now receives the active worktree and workspace execution host identifiers. Tests cover worktree and folder workspaces with repeated IDs across hosts. A new Docker-gated E2E test checks explorer contents and file changes for selected SSH hosts. CI routing and the Docker conversion workflow now include the selected-host spec.


Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to 0bb72

The selected-host behavior has no established production defect, but the cross-host test may miss a delayed incorrect update. Strengthen the test before relying on it for this regression.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check Warning The description is detailed and covers the change, rationale, visual proof, testing, review notes, and checklist. However, the required Linked Issue section does not provide an issue reference and exp… Add a valid linked issue reference in the required format, such as "Fixes #1234", or obtain repository-maintainer guidance if the change is exempt from the issue requirement.
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 7 files. (1 skipped: 1 … 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 and concisely describes the main product change: keeping explorer file watches on the selected remote host.
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.

Full details: Description check

Explanation

The description is detailed and covers the change, rationale, visual proof, testing, review notes, and checklist. However, the required Linked Issue section does not provide an issue reference and explicitly states that no existing issue exists.


Full details: Docstring Coverage

Explanation

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 7 files. (1 skipped: 1 unsupported.)



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

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

🧹 Nitpick comments (1)
tests/e2e/ssh-orcad-explorer-selected-host.spec.ts (1)

190-190: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Wait for explorer processing before checking the negative case.

The console wait alone does not close this gap. The test installs its logger before selecting the host, so it can observe dispatch before the explorer listener. Even after moving the logger, the explorer schedules refresh work after the console message.

Wait for the other-host event after the selected tree is ready. Then use the existing selected-host deletion update as a later explorer synchronization point before asserting that OTHER_HOST_ONLY.txt remains absent.

Suggested test synchronization
-      await page.evaluate(() => {
-        window.addEventListener('orca:worktree-file-change', (event) => {
-          if (event instanceof CustomEvent) {
-            console.log('[file-change-event]', JSON.stringify(event.detail))
-          }
-        })
-      })
       const worktreeId = folderWorkspaceKey(folderId)
...
       await expect(
         page.getByText(`INITIAL_${selectedHost === 'A' ? 'B' : 'A'}.txt`, { exact: true })
       ).toHaveCount(0)
+      await page.evaluate(() => {
+        window.addEventListener('orca:worktree-file-change', (event) => {
+          if (event instanceof CustomEvent) {
+            console.log('[file-change-event]', JSON.stringify(event.detail))
+          }
+        })
+      })
...
       const otherHost = selectedHost === 'A' ? hostB : hostA
+      const otherEnvironmentId = selectedHost === 'A' ? environmentB.id : environmentA.id
+      const otherHostChanged = page.waitForEvent('console', {
+        predicate: (message) =>
+          message.text().startsWith('[file-change-event]') &&
+          message.text().includes('OTHER_HOST_ONLY.txt') &&
+          message.text().includes(otherEnvironmentId),
+        timeout: 15_000
+      })
       otherHost.exec?.(`printf 'other host\n' > '${folderPath}/OTHER_HOST_ONLY.txt'`)
-      await expect(page.getByText('OTHER_HOST_ONLY.txt', { exact: true })).toHaveCount(0)
+      await otherHostChanged
       host.exec?.(`rm '${folderPath}/${marker}'`)
       await expect(page.getByText(marker, { exact: true })).toHaveCount(0, { timeout: 10_000 })
+      await expect(page.getByText('OTHER_HOST_ONLY.txt', { exact: true })).toHaveCount(0)

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 89cf09c2-b0bd-404d-bf8c-10668985a1b6
📥 Commits

Reviewing files that changed from the base of the PR and between 9be39b6 and 0bb7200.

📒 Files selected for processing (8)
  • .github/workflows/e2e.yml
  • config/scripts/ci-e2e-job-selection.mjs
  • config/scripts/ci-e2e-job-selection.test.mjs
  • config/scripts/pr-e2e-source-routing.mjs
  • src/renderer/src/components/right-sidebar/file-explorer-operation-owner.ts
  • src/renderer/src/components/right-sidebar/file-explorer-watch-selected-host.test.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerWatch.ts
  • tests/e2e/ssh-orcad-explorer-selected-host.spec.ts

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

@OrcaWin
OrcaWin merged commit 6c20143 into main Oct 9, 2026
39 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.

2 participants