Repository navigation
feat(pull-requests): review threads in the diff pane and Review tab as the viewer - #8980
Conversation
|
Caution Review failedThe pull request is closed. Finishing Touches
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 |
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
[Medium impact] The PR appears safe to merge, with two non-blocking concerns from the previous review still open. FindingsFix with agent prompt### Issue 1
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useReviewTab/useReviewTab.tsx:undefined-39
The Review tab now needs the viewer's GitHub login, but it never shows when that login is missing. If the host knows the linked PR but the viewer has no local login or Superset connection, `threadsQuery` fails and the tab shows an empty comment list.
Pass `threadsQuery.isError` and `fetchFailed` through to the comments view, and offer a way to connect GitHub instead of saying there are no comments.
### Issue 2
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/CommentsSection/CommentsSection.tsx:144-147
`handleResolveAll` now calls an action that refreshes the entire thread list after each thread is resolved. Previously, it refreshed once after the batch finished. Resolving many threads can now start repeated GitHub reads for the same PR.
Let the batch skip each action's refresh, then refresh once after all writes finish.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryMoves workspace review threads to the viewer’s GitHub access and one shared cache.
The previous-review ancestry and merge-base checks did not both pass, so this review used the full PR diff. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Host["Host: linked PR record"] --> Target["useLinkedPullRequest"]
Target --> Threads["usePullRequestThreads"]
Threads --> Diff["Diff pane"]
Threads --> Review["Review tab"]
Threads --> Pane["PR pane"]
Diff --> Actions["Viewer thread actions"]
Review --> Actions
Pane --> Actions
Actions --> Cache["Refresh shared thread cache"]
Cache --> Threads
Reviews (2) · Last reviewed commit: "feat(pull-requests): review threads in t..." · Reviewed by Greptile |
| refetchOnWindowFocus: true, | ||
| }, | ||
| ); | ||
| const threadsQuery = usePullRequestThreads(target, { enabled: hasPR }); |
There was a problem hiding this comment.
Missing login hides review comments
The Review tab now needs the viewer's GitHub login, but it never shows when that login is missing. If the host knows the linked PR but the viewer has no local login or Superset connection, threadsQuery fails and the tab shows an empty comment list.
Pass threadsQuery.isError and fetchFailed through to the comments view, and offer a way to connect GitHub instead of saying there are no comments.
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: 38
Comment:
**Missing login hides review comments**
The Review tab now needs the viewer's GitHub login, but it never shows when that login is missing. If the host knows the linked PR but the viewer has no local login or Superset connection, `threadsQuery` fails and the tab shows an empty comment list.
Pass `threadsQuery.isError` and `fetchFailed` through to the comments view, and offer a way to connect GitHub instead of saying there are no comments.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| const results = await Promise.allSettled( | ||
| resolvableThreadIds.map((threadId) => | ||
| setReviewThreadResolution.mutateAsync({ | ||
| workspaceId, | ||
| threadId, | ||
| resolved: true, | ||
| }), | ||
| threadActions.setResolved(threadId, true), | ||
| ), |
There was a problem hiding this comment.
Resolve all repeats GitHub reads
handleResolveAll now calls an action that refreshes the entire thread list after each thread is resolved. Previously, it refreshed once after the batch finished. Resolving many threads can now start repeated GitHub reads for the same PR.
Let the batch skip each action's refresh, then refresh once after all writes finish.
Knowledge Base Used: Hold GitHub failures and reduce pull-request refresh load
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/CommentsSection/CommentsSection.tsx
Line: 144-147
Comment:
**Resolve all repeats GitHub reads**
`handleResolveAll` now calls an action that refreshes the entire thread list after each thread is resolved. Previously, it refreshed once after the batch finished. Resolving many threads can now start repeated GitHub reads for the same PR.
Let the batch skip each action's refresh, then refresh once after all writes finish.
**Knowledge Base Used:** [Hold GitHub failures and reduce pull-request refresh load](https://app.greptile.com/personal-org-6810/-/custom-context/knowledge-base/paradevai/paradev/-/reverts/incident-mitigation_7246-20260906-github-quota-0d373cc.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
1e367c2 to
7e10066
Compare
35022d5 to
cbad5f6
Compare
d5fe261 to
209263d
Compare
37ad061 to
449ec1e
Compare
209263d to
ef193c3
Compare
…s the viewer The diff pane's comment threads and annotations, the sidebar Review tab and its resolve-all read and write review threads with the viewer's own GitHub login, through the same client and cache as the PR pane. The host only says which pull request the workspace links to. The shared thread read now also returns the conversation comments the Review tab lists.
…all with one refresh Without a GitHub login the Review tab offered no comments and no reason; it now says so and offers to connect GitHub, or that the comments could not load. Resolve all writes every thread and then reads the list once, as it did before, instead of once per thread.
- Reads the organization's App cannot make ask the viewer to connect GitHub, instead of a not-found with no way forward. - Mobile PR rows read their diffstat with one REST request again. - Merges return GitHub's message; failed thread reads are logged with their cause. - Mobile Settings says it could not check rather than "Not connected". - The sandbox note says which identity reads and which writes; German, Dutch and Polish wording says "with your account" rather than calques.
449ec1e to
2ca017a
Compare
Stacked on #8799 (→ #8771 → #8765).
Summary
The last places that read or resolved review threads with the workspace host's GitHub access now act as the viewer, the same way the PR pane does (local
ghfirst, then the Superset connection):CommentThread, both reply and resolveCommentsSectionThe host still answers which PR the workspace links to (
git.getPullRequestreads its own database; it doesn't call GitHub). That lookup is now one hook,useLinkedPullRequest, which also returns the PR as aPullRequestTarget.One cache for threads. Every surface reads
usePullRequestThreads(target)and writes throughuseReviewThreadActions(target). Resolving a thread in the PR pane updates the diff pane and the Review tab right away; the old cross-cache invalidation ofgit.getPullRequestThreadsis gone.Conversation comments. The Review tab lists them, and the host's thread read used to supply them.
pullRequestOnGithub(...).threads()now returns the latest 100 in the same GraphQL request. The PR pane keeps taking its conversation from the PR read, so they aren't shown twice.CommentThreadnow takesonReply/onSetResolvedprops instead of calling the host itself, so its test passes plain functions.After this, no desktop or mobile code calls the deprecated host thread procedures (
git.*Thread*,pullRequests.getThreads/replyToThread/setThreadResolution).Follow-up
The diff pane's
CommentThreadand the Code tab'sPullRequestCommentThreadare now the same component with injected actions and could be merged.Test plan
tscclean in touched files;check:i18n,sherifSummary by cubic
Review threads in the diff pane and sidebar Review tab now act as the viewer (local
ghfirst, then the Superset connection) instead of the workspace host's GitHub access, matching the PR pane.usePullRequestThreadsanduseReviewThreadActions, so resolving or replying in one view updates the others immediately; "resolve all" writes every thread, then refreshes the list once.useLinkedPullRequestis the single hook for which PR a workspace links to; the host still answers the lookup, and the PR is returned as aPullRequestTarget.CommentThreadnow takesonReplyandonSetResolvedprops instead of calling the host itself.git.*Thread*,pullRequests.getThreads/replyToThread/setThreadResolution) anymore.Follow-up
The diff pane's
CommentThreadand the Code tab'sPullRequestCommentThreadare now the same component with injected actions and could be merged.Written for commit 2ca017a. Summary will update on new commits.
Review fixes (whole stack)
gh, which could show a PR the viewer can't access.getPullRequestDiffstat), not the full detail read.messageagain, and failed thread reads log their cause.