Repository navigation
perf(renderer): project terminal topology consumers - #16171
Conversation
📝 WalkthroughWalkthroughThe change introduces a reusable memoized projection for worktree tab buckets. Session persistence, sidebar activity inputs, terminal parking, terminal rendering, and retained-agent synchronization now consume projected tab data. Equivalent title-only updates reuse existing projections. Tests cover large worktree maps, selective bucket inspection, terminal topology changes, persistence suppression, and retained-agent tab freshness. 🚥 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/lib/session-write-subscriber.ts (1)
106-109: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueShorten this rationale comment.
Reduce this comment to one concise line. It repeats implementation detail.
As per coding guidelines: “Comments must be concise, non-obvious, and brief—prefer one line.”
Proposed change
- // Why: the subscriber fires on every store update (agent status, usage - // refreshes, runtime title ticks, …). Without this gate each fire reset - // the debounce, and when it finally expired buildWorkspaceSessionPayload - // crossed 70-110ms with many tabs, tripping setTimeout violations. Terminal - // and unified maps use durable per-worktree projections, so display frames - // reuse the prior identity while a real session change keeps fresh tabs for - // the eventual getState() patch build. `null` makes the first fire proceed. + // Ignore display-only tab updates so they do not reset persistence debounce.Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 072c7aa2-4970-4ab8-848d-0acde6f1dc78
📒 Files selected for processing (10)
src/renderer/src/components/Terminal.tsxsrc/renderer/src/components/dashboard/useRetainedAgents.test.tssrc/renderer/src/components/dashboard/useRetainedAgents.tssrc/renderer/src/components/sidebar/visible-worktree-activity-inputs.test.tssrc/renderer/src/components/sidebar/visible-worktree-activity-inputs.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.test.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.tssrc/renderer/src/lib/session-write-subscriber.test.tssrc/renderer/src/lib/session-write-subscriber.tssrc/renderer/src/lib/worktree-tab-bucket-projection.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.
(cherry picked from commit a117bff)
Problem
Display-only terminal title publications replaced the outer terminal maps. Remaining renderer consumers treated that publication as a fleet transition, rebuilding retained-agent snapshots, re-running sidebar all-tab activity projection, reconsidering Terminal root parking/topology, and waking session persistence even though only leaf chrome changed.
At 300 worktrees, a fast agent spinner could repeatedly fan one label update across the entire fleet.
What
ELI5
A terminal title can wiggle many times a second like an animated name tag. Before, every wiggle made Orca recount every workspace, reconsider parking terminals, rebuild retained-agent snapshots, and wake session saving. Now the animated name tag updates only its small label. Orca revisits the fleet only when a terminal is actually added, removed, moved, connected to a PTY, queued to spawn, remounted, or durably renamed.
Proof / no regression
typecheck:webpassed.User tradeoffs
Readiness verdict
CLEAN — P0: 0, P1: 0, P2: 0.
All seven review sections are CLEAN with P0=0, P1=0, P2=0:
Mobile
No mobile-facing surface. This changes renderer-side desktop/web-client subscription and persistence gating only; protocols and mobile UI are unchanged.
Residual risk