Repository navigation
Fix renderer starvation blocking settings and worktree switching - #16138
Conversation
8cecef5 to
95fc1cd
Compare
|
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: 📥 CommitsReviewing files that changed from the base of the PR and between 8cecef5538ba3ece30e1fa7c2b39c6f79c02ca81 and 95fc1cd. 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe terminal parking effect now derives a revision key from policy-relevant tab properties and uses a current store snapshot during parking decisions. Settings search state is managed by a local field through the app store instead of sidebar props. Sidebar worktree activation now occurs before ephemeral VM resume handling, with tests covering pending runtime wake behavior. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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 |
stablyai#16138 stopped reading tabsByWorktree through the effect deps, reading it once from the store instead so terminal load cannot stall navigation. This branch enriches the same list with each tab's active leaf, which the owner check needs as pane identity. Kept both: the tabs come from main's single store read, and the layout map is read beside it rather than per tab, which is what the branch's inline getState was doing. Taking main's side wholesale here would compile and pass every test — activeLeafId is optional, so every ownership check would silently fall back to a null leaf. Nothing in the suite covers this call site.
ELI5
Orca had three chores in the path of two simple actions. It repeatedly rechecked every parked terminal when only a terminal label changed, rebuilt most of Settings for every search keystroke, and waited for the backend before showing a workspace switch. With hundreds of worktrees and terminals, those chores could crowd out clicks and delay the search timer. This PR narrows the terminal check to meaningful changes, keeps typing local to the search box, and makes navigation independent from a slow backend wake-up.
Problem
The live packaged app became intermittently unusable at accumulated-state scale:
The app later becoming responsive without a restart is consistent with a burst that eventually drained, rather than a permanently dead process. This PR removes work from the interaction path so the same kind of burst is less able to starve input and navigation.
What this solution fixes
1. Stops display-only terminal churn from starting global parking work
Terminalstays mounted across routes and watches terminal tabs for every worktree. The parking effect previously depended on the completetabsByWorktreeobject, so any immutable tab update—including a title change—could rerun worktree parking, watcher reconciliation, retention, and timer bookkeeping across the mounted terminal fleet.The effect now depends on a semantic key containing only the fields the parking policy consumes:
Title-only and other display-only changes therefore do not start the global parking pass. Real lifecycle changes still do.
2. Keeps each Settings keystroke out of the full Settings render tree
Settings has an immediate input value and a separately debounced query that drives filtering. The full Settings parent previously subscribed to the immediate value only to pass it back to the search box. Every keystroke could therefore rebuild the large Settings tree before the debounced query applied; under renderer saturation, the trailing timer was delayed repeatedly, producing “text changes but results do not.”
The immediate subscription now lives inside the search-field component. Typing updates the input immediately without rerendering every Settings section. The parent remains subscribed only to the applied query used for filtering.
3. Makes worktree navigation local-first instead of backend-gated
A sidebar click previously awaited optional ephemeral-runtime resume IPC before publishing the selected worktree. If the provider or backend was slow, the visible workspace did not change and the click looked ignored.
The click now publishes the local worktree selection first, then wakes and refreshes the runtime asynchronously. A slow backend can leave the selected workspace temporarily disconnected, but it cannot trap navigation on the previous workspace. Wake failures still produce an error toast.
Expected user-visible result
Tradeoff
A slow or failed VM wake now shows the selected workspace in a loading/disconnected state instead of keeping the user on the previous workspace until wake succeeds. No terminal is deleted or shut down by this ordering change.
Scope
This PR targets the renderer interaction paths directly associated with the observed symptoms. It does not claim to eliminate every source of background work: the live profile also has large persisted state, Git activity, and terminal inventory. Those remain separate performance surfaces.
Verification
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/sidebar/sleep-worktree-activation-race.test.ts src/renderer/src/lib/sidebar-worktree-activation.test.ts src/renderer/src/store/slices/settings-search-state.test.ts src/renderer/src/components/settings/SettingsSidebar.test.tsx src/renderer/src/components/settings/Settings.load-performance.test.ts src/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.test.tspnpm run typecheck:webOrca: fix/live-ui-backend-starvationephemeralVm.resumeWorkspacewith a never-settling promise, clicked the real workspace row, and observedactiveWorktreeIdplus the terminal surface update immediately