[codex] show review counts in v2 sidebar header#4670
Conversation
|
Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
|
Ready to review this PR? Stage has broken it down into 4 individual chapters for you:
Chapters generated by Stage for commit cfb062a on May 17, 2026 8:18pm UTC. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds capped badge formatting to SidebarHeader, only shows the Review tab badge when open review comments exist, threads workspaceId into review UI, implements a bulk “Resolve all” in CommentsSection, and introduces side-aware diff focus plumbing across panes and annotations. ChangesSidebar badge rendering
Review threads: resolve all & workspace wiring
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 surfaces the Review tab's existing open-comment count as a badge in the v2 workspace sidebar header, for both normal and compact layouts. It refactors the duplicated button markup in
Confidence Score: 4/5Safe to merge; the badge and accessibility changes are self-contained with no regressions to existing functionality. The implementation is clean and the refactor is correct. One thing worth a follow-up: conversation comments are always marked The
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/SidebarHeader/SidebarHeader.tsx | Adds badge rendering to tab buttons in both normal and compact layouts; refactors duplicated button markup into a shared btn variable; adds accessible aria-label including badge count. |
| apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useReviewTab/useReviewTab.tsx | Changes badge from always emitting the raw count (including 0) to emitting undefined when count is zero, so the header correctly hides the badge when there is nothing pending. |
Sequence Diagram
sequenceDiagram
participant Hook as useReviewTab (hook)
participant Type as SidebarTabDefinition
participant Header as SidebarHeader (component)
participant UI as Rendered Tab Button
Hook->>Hook: filter comments where !isResolved → openCommentCount
Hook->>Type: "badge = openCommentCount > 0 ? openCommentCount : undefined"
Type->>Header: "tabs[] with optional badge: number | undefined"
Header->>Header: "typeof tab.badge === number && > 0 → badge string or null"
Header->>Header: "label = badge ? "Review (N)" : "Review""
alt compact mode
Header->>UI: Tooltip wrapping button with aria-label, icon, absolute badge span
else normal mode
Header->>UI: button with aria-label, visible label text, inline badge span
end
Note over Header,UI: badge > 99 rendered as "99+"
Note over Header,UI: badge hidden when undefined or 0
Comments Outside Diff (1)
-
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useReviewTab/useReviewTab.tsx, line 147-158 (link)Conversation comments always inflate the badge count
conversationCommentsare always pushed withisResolved: false, so they permanently contribute toopenCommentCount. With the badge now visible in the header, users will always see these comments counted as "pending" even though there is no way to mark them as resolved through the UI. Depending on how many PR-body/issue-level comments exist, the badge count may be consistently higher than users expect, and will never reach zero while any conversation comments remain.Prompt To Fix With AI
This is a comment left during a code review. Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useReviewTab/useReviewTab.tsx Line: 147-158 Comment: **Conversation comments always inflate the badge count** `conversationComments` are always pushed with `isResolved: false`, so they permanently contribute to `openCommentCount`. With the badge now visible in the header, users will always see these comments counted as "pending" even though there is no way to mark them as resolved through the UI. Depending on how many PR-body/issue-level comments exist, the badge count may be consistently higher than users expect, and will never reach zero while any conversation comments remain. How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useReviewTab/useReviewTab.tsx:147-158
**Conversation comments always inflate the badge count**
`conversationComments` are always pushed with `isResolved: false`, so they permanently contribute to `openCommentCount`. With the badge now visible in the header, users will always see these comments counted as "pending" even though there is no way to mark them as resolved through the UI. Depending on how many PR-body/issue-level comments exist, the badge count may be consistently higher than users expect, and will never reach zero while any conversation comments remain.
Reviews (1): Last reviewed commit: "show review counts in v2 sidebar header" | Re-trigger Greptile
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/hooks/useReviewTab/components/CommentsSection/CommentsSection.tsx:
- Around line 147-176: In handleResolveAll, wrap the await
utils.git.getPullRequestThreads.invalidate({ workspaceId }) call in its own
try/catch so any rejection is handled and won’t surface as an unhandled promise
rejection; on catch, log the error (e.g. console.error or processLogger) and
optionally show a toast.error with the rejection reason, then continue to
compute failedCount and clear isResolvingAll using isMountedRef; keep the rest
of the Promise.allSettled logic and ensure setReviewThreadResolution.mutateAsync
and resolvableThreadIds flow remain unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5aecaea9-184b-4162-970e-ece7d6d47fa9
📒 Files selected for processing (3)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useReviewTab/components/CommentsSection/CommentsSection.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useReviewTab/components/ReviewTabContent/ReviewTabContent.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useReviewTab/useReviewTab.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useReviewTab/useReviewTab.tsx
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileEntry/DiffFileEntry.tsx">
<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileEntry/DiffFileEntry.tsx:76">
P2: `hasFocusRequest` is latched by non-null values, so a single line-jump can permanently force full diff mount/expanded-unchanged behavior instead of handling focus as a one-time request.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
* show review counts in v2 sidebar header * add resolve all action to review sidebar * split review sidebar comment sections * show outdated review tag in sidebar * fix review comment diff targets * improve review comment diff jumps * reduce review diff jump flicker * use current review thread anchors * use rendered diff indexes for review jumps * revert review comment diff jump changes
Summary
SidebarTabDefinition.badgevalues in the v2 workspace right-sidebar header.Why
The review tab was already computing an open review/comment count, but the v2 right-sidebar header did not render tab badges, so users could not see pending review work from the header.
Validation
bun run --cwd apps/desktop typecheckbun run lintbun run --cwd apps/desktop test 'src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/PRActionHeader/utils/getPRFlowState/getPRFlowState.test.ts'Summary by cubic
Render tab badges in the v2 right-sidebar header and show the Review tab’s open review count. Split the Review tab into Conversations and Review with copy actions and bulk resolve, and improve open‑in‑diff targeting using thread anchors and side awareness.
SidebarTabDefinition.badgeon header tabs; capped at 99+, hidden at 0, included in tooltip/aria-label, positioned correctly in compact mode.git.getPullRequestThreads.Written for commit cfb062a. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
New Features
Improvements
Bug Fixes