Repository navigation
fix(sidebar): stabilize cross-host project grouping - #11805
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe runtime status store now shows localized disconnect notifications with retry and dismissal behavior. Callers can suppress notifications during intentional disconnect flows. Tests cover disconnect, recovery, retry, cleanup, and suppression cases. Project grouping now identifies execution surfaces and normalized checkout identities, splitting headers only when multiple distinct checkouts share one surface. Tests cover projection twins and cross-platform setup grouping. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
Greptile SummaryThis PR fixes two related problems: cross-host project grouping fragmentation in the sidebar and a missing disconnect notification when an Orca runtime server goes offline. The core grouping fix narrows ambiguity detection from the whole project to the exact surface (project × host × execution target × filesystem namespace), so only the specific surface with genuinely independent checkouts gets split headers. The disconnect toast adds a one-shot warning with a Retry action when a previously-connected server becomes unreachable, with clean suppression for intentional disconnects and cold-start probes.
Confidence Score: 5/5Safe to merge — changes are scoped to grouping presentation logic and a transient toast notification with no mutations to stored state or IPC behavior. The grouping refactor correctly narrows ambiguity to the per-surface level and uses normalized paths to deduplicate projection twins. The toast lifecycle is guarded by activation symbols that prevent stale callbacks and is properly cleaned up through every removal path (remove, clear, retain, intentional disconnect, recovery). All edge cases — cold-start offline, repeated failed probes, retry deduplication, environment removal during a pending retry — are exercised by the new tests and hold up under manual analysis. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/renderer/src/store/slices/runtime-status.ts | Adds disconnect toast lifecycle with activation-symbol guards, retry deduplication, and suppress option; previous-status capture moved before set() (safe in synchronous Zustand); all dismiss paths (remove, clear, retain, suppress, recover) are covered. |
| src/renderer/src/components/sidebar/worktree-list-groups.ts | Surface-scoped ambiguity detection replaces project-wide detection; checkout identity uses normalized paths so projection twins count once; folder/provisioned setups excluded from checkout count; execution surface normalization handles SSH/WSL/Windows/runtime targets. |
| src/renderer/src/store/slices/runtime-status.test.ts | Comprehensive new tests for cold-start suppression, connected→offline toast, recovery dismiss, retry dedup, intentional-disconnect suppress, and removal/clear scenarios; fake timers used correctly for async retry flow. |
| src/renderer/src/components/sidebar/worktree-list-groups.test.ts | Updates existing 'splits all setups' test to verify that only the ambiguous surface is split; adds two new grouping tests (projection twins, folder + Windows setups). |
| src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx | Threads suppressDisconnectToast through the manual disconnect call so the new toast logic doesn't fire on intentional user action. |
| src/renderer/src/components/status-bar/SshStatusSegment.tsx | Same suppress-toast threading as RuntimeEnvironmentsPane for the SSH status bar disconnect path. |
| src/renderer/src/i18n/locales/en.json | Adds runtimeHostDisconnectedDescription under the correct auto-key path for the disconnect toast description string. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[setRuntimeEnvironmentStatus called] --> B{options.suppressDisconnectToast?}
B -- Yes --> C[dismissRuntimeDisconnectedToast\nclear active toast]
B -- No --> D{previous.status === null\nAND new status !== null?}
D -- Yes --> E[dismissRuntimeDisconnectedToast\nserver recovered]
D -- No --> F{previous exists AND\nprevious.status !== null\nAND new status === null?}
F -- Yes --> G[showRuntimeDisconnectedToast\nconnected to offline transition]
F -- No --> H[No toast action\nnull to null or first probe]
G --> I[toast.warning shown\nwith Retry action]
I --> J{User clicks Retry}
J --> K{retrying flag?}
K -- Already retrying --> L[event.preventDefault\nsilently ignore]
K -- Not retrying --> M[retrying = true\nshowToast infinity duration\nrefreshRuntimeEnvironmentStatus]
M --> N{Probe result}
N -- Reachable --> O[setRuntimeEnvironmentStatus\nnon-null status\ndismissRuntimeDisconnectedToast]
N -- Still offline --> P{activation still current\nAND env still saved?}
P -- Yes --> Q[showToast 4s duration]
P -- No --> R[No new toast\nstale activation guard]
S[setRuntimeEnvironments / clearRuntimeEnvironmentStatus\nretainRuntimeEnvironmentStatuses] --> T[dismissRuntimeDisconnectedToast\nfor each retired/removed id]
Reviews (4): Last reviewed commit: "fix(runtime): keep offline retry toast v..." | Re-trigger Greptile
| } | ||
|
|
||
| const connectionGenerationByEnvironment = new Map<string, number>() | ||
| const activeRuntimeDisconnectedToasts = new Map<string, symbol>() |
There was a problem hiding this comment.
Module-level toast map outlives store recreation
activeRuntimeDisconnectedToasts is a module-level singleton, so it is never reset when the Zustand store is re-created (e.g. hot-module replacement in development, or any future multi-store test pattern). If HMR tears down and rebuilds the renderer while a disconnect toast is active, Sonner clears its own DOM state but the map still has the entry. The next connected→offline transition calls showRuntimeDisconnectedToast as expected, but the preceding dismissRuntimeDisconnectedToast call inside clearRuntimeEnvironmentStatus would silently skip the toast.dismiss branch because the map entry from the old activation is still present — the new set() would then no-op.
This is benign in production (single renderer lifetime, single store) and the activation-symbol guard already prevents stale callbacks from mutating the map. Worth tracking if the store factory ever gets exercised more than once per process.
* fix(sidebar): stabilize cross-host project grouping * fix(runtime): suppress outage toast on disconnect * fix(runtime): dismiss intentional outage toast * fix(runtime): keep offline retry toast visible


Summary
Keep one logical project grouped under one sidebar identity across local, SSH, and Orca-server checkouts, even when a remote server goes offline or the setup catalog contains duplicate/folder projection rows.
Also show a retryable warning toast when a previously connected Orca server becomes unavailable.
Before
One execution surface with multiple setup rows marked the entire project as ambiguous. This included:
Once marked ambiguous, every checkout on every host switched to a setup-specific group key. The label collision fallback then exposed path tails, so one
stablyai/orcaproject could suddenly look like three unrelated sidebar projects after a catalog refresh:A server outage could trigger the refresh that exposed the split, even though connection status was not itself part of the grouping key. Users retained the persistent red disconnected indicator but received no transient explanation.
After
Conceptually, the same checkouts remain presented as:
Orca.Screenshots
Not included: the regression requires a multi-host catalog with duplicate projections plus a live server transition. The before/after presentation is documented above and covered by grouping and runtime-status regression tests.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation run:
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/sidebar/worktree-list-groups.test.ts src/renderer/src/store/slices/runtime-status.test.ts src/renderer/src/components/right-sidebar/file-explorer-operation-generation.test.ts src/renderer/src/store/slices/runtime-environment-ssh.test.ts— 154 tests passedpnpm run typecheck:weboxlinton the four changed TypeScript filespnpm run verify:localization-catalogpnpm run verify:localization-extractionpnpm run verify:localization-coveragepnpm run check:max-lines-ratchetgit diff --checkAI Review Report
Reviewed the grouping boundary, checkout identity, disconnect transition lifecycle, retry behavior, and cleanup paths.
The review explicitly checked macOS, Linux, Windows drive paths, WSL UNC aliases, local/SSH/runtime execution hosts, nested SSH identity spelling, and folder-workspace behavior. It also confirmed that this PR does not change shortcuts, shell commands, terminal launching, or other Electron platform behavior.
The review flagged that cleanup initially called Sonner's dismiss path even when no toast had been shown. That was tightened to track active toast generations only, preventing unnecessary renderer work and stale callback races; headless consumer tests were added to the validation set.
Security Audit
No security follow-up is required.
Notes