Repository navigation
perf(dashboard): build sidebar bucket counts without cards - #17497
Conversation
Greptile SummaryThe PR replaces sidebar card construction with a count-only dashboard projection while preserving shared row and bucket semantics.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/dashboard/build-dashboard-bucket-counts.ts | Adds the count-only projection using the same workspace, row, orchestration, and bucket derivation used by dashboard snapshots. |
| src/renderer/src/components/dashboard/dashboard-row-bucket.ts | Centralizes title-derived, unseen, monitoring, dot-state, and bucket classification semantics. |
| src/renderer/src/components/dashboard/dashboard-orchestration-selection.ts | Extracts the existing singleton-versus-batched orchestration selection for reuse by both projections. |
| src/renderer/src/components/dashboard/build-dashboard-snapshot.ts | Reuses the extracted orchestration and bucket projections and accepts unified agent-session tabs. |
| src/renderer/src/components/dashboard/useAgentBucketCounts.ts | Switches sidebar totals to the count-only builder and updates the previously stale documentation. |
| src/renderer/src/components/dashboard/useDashboardPopoutBridge.ts | Republishes snapshots when unified agent-session tab topology changes. |
| src/renderer/src/components/dashboard/useLiveDashboardSnapshot.ts | Subscribes the live snapshot builder to unified agent-session tab changes. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
S[Renderer store state] --> W[Collect active workspaces]
W --> O[Select orchestration]
O --> R[Build agent rows]
R --> P[Shared bucket projection]
P --> C[Sidebar bucket counts]
P --> D[Dashboard cards]
Reviews (4): Last reviewed commit: "refactor(dashboard): share bucket projec..." | Re-trigger Greptile
📝 WalkthroughWalkthroughThe PR centralizes dashboard orchestration selection and row bucket projection. Merge Risk: 🔴 Critical · up to The sidebar count implementation currently does not compile because two required selector imports are missing, so the PR is not merge-ready until those imports are restored. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the implementation, rationale, validation, performance impact, and trade-offs, but it omits required template sections. It does not include a Linked Issue, Visual Proof or the required N/A explanation, Testing checklist, AI Disclosure, Review, Agent skill upstream boundary, Notes, or Checklist. Resolution Add the missing required sections. Include a linked issue after “Fixes #”, provide before-and-after visual proof or write exactly “N/A” with a reason, complete the Testing checklist, and address AI disclosure, Review, Agent skill upstream boundary, Notes, and Checklist items.
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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.
ℹ️ No critical issues — one maintainability suggestion inline.
Reviewed changes
This PR adds a count-only projection for the always-mounted sidebar dashboard entry, replacing the full buildDashboardSnapshot(…, { includeCardDetails: false, includeFilterOptions: false }) call with buildDashboardBucketCounts.
- New count-only builder —
buildDashboardBucketCountsreuses the shared worktree/agent row machinery (buildWorktreeAgentRows,applyAgentRowLineage, the indexed selectors, and the orchestration batch/singleton selection) to derive per-state bucket counts without allocating cards, host metadata, filter options, or terminal-preview inputs. - Hook wiring —
useAgentBucketCountsnow calls the new builder with the same input slice (settings: nullretained). - Tests — a new alignment test pins
buildDashboardBucketCountsoutput to the bucket totals of a full snapshot across local/remote/folder workspaces including a title-derived card; the hook test now mocks the new builder.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues — one minor test-coverage suggestion inline.
Reviewed changes
- Threaded
unifiedTabsByWorktreeinto the count-only sidebar projection (useAgentBucketCounts) and the in-window board (useLiveDashboardSnapshot), and added it to the pop-out republish gate, so done structured sessions whose tab exists only in unified tabs are attributed to their worktree and counted. - Added
unifiedTabsByWorktreetoDashboardSnapshotStateso the shared builder type documents the new input. - Added a parity test for a done structured session present only in unified tabs, and a republish test for unified agent-session tab changes.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2ece246b-c084-490d-9bcd-ed165012f2fa
📒 Files selected for processing (10)
src/renderer/src/components/dashboard/build-dashboard-bucket-counts.tssrc/renderer/src/components/dashboard/build-dashboard-snapshot-folder-workspace.test.tssrc/renderer/src/components/dashboard/build-dashboard-snapshot.tssrc/renderer/src/components/dashboard/dashboard-orchestration-selection.tssrc/renderer/src/components/dashboard/dashboard-row-bucket.tssrc/renderer/src/components/dashboard/useAgentBucketCounts.test.tsxsrc/renderer/src/components/dashboard/useAgentBucketCounts.tssrc/renderer/src/components/dashboard/useDashboardPopoutBridge.test.tsxsrc/renderer/src/components/dashboard/useDashboardPopoutBridge.tssrc/renderer/src/components/dashboard/useLiveDashboardSnapshot.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior Pullfrog review (7e128dc), this delta removes the duplicated bucket and orchestration derivation that both builders carried:
- Shared row bucket projection — new
dashboardRowBucketProjection(dashboard-row-bucket.ts) computesisTitleDerived,dotState,workingMode,unseen, andbucketonce; bothbuildDashboardSnapshotandbuildDashboardBucketCountsnow call it. - Shared orchestration selection — new
selectDashboardOrchestration(dashboard-orchestration-selection.ts) encapsulates the singleton-vs-batch orchestration block previously copy-pasted into both builders. - Test pin for unified-tab forwarding —
useAgentBucketCounts.test.tsxnow asserts the count builder receivesunifiedTabsByWorktree, closing the gap flagged in the prior review.
Both prior suggestions are addressed, and the focused dashboard suites pass (52 tests across 4 files).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…17497) * perf(dashboard): build sidebar bucket counts without cards * fix dashboard bucket parity for unified agent tabs * docs(dashboard): clarify count projection comment * refactor(dashboard): share bucket projection derivation

Summary
Validation
ELI5
The sidebar only needs four totals, but it used to build a complete dashboard card for every agent and then throw those cards away. The count projection now walks the same rows and updates four counters, so the sidebar gets identical counts without creating card details.
Performance Measurement
The committed mixed local/remote parity fixture contains two top-level agent rows and verifies that both projections produce identical bucket totals:
DashboardCardrecords plus the per-row presentation projection (labels, conversation fields, and card metadata).DashboardCardrecords; one four-field counts record is returned.The committed fixture is intentionally small; it measures the production allocation boundary rather than pretending to be a large-app benchmark. The same per-row construction means a 1,024-row input would avoid 1,024 discarded card records, but both paths remain O(rows) and bucket classification is unchanged.
Run the focused projection/parity coverage with:
pnpm test src/renderer/src/components/dashboard/build-dashboard-snapshot-folder-workspace.test.ts src/renderer/src/components/dashboard/useAgentBucketCounts.test.tsx src/renderer/src/components/dashboard/build-dashboard-snapshot.test.ts --runUser-Facing Trade-offs
None. Bucket classification, local/remote/folder/structured-tab parity, title-derived rows, and ACK/unseen behavior are preserved. Unrelated store writes still do not recompute counts; unified agent-session tab changes now refresh them for correctness.