Chat Prs Panel Live Refresh#670
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
📝 WalkthroughWalkthroughAdds ChangesLive PR Refresh Coalescing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
|
@copilot review but do not make fixes |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 32c61c8142
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
25032c9 to
d026481
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d026481101
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/components/chat/ChatPrPane.tsx`:
- Around line 129-153: The refresh flow in ChatPrPane’s refresh useCallback is
keeping loading true until refreshLinkedPrCoalesced finishes, so the cached PR
never renders immediately. Update refresh to clear loading right after
window.ade.prs.getForLane(laneId) resolves and setCurrentPr(cached) runs, then
let the live update proceed asynchronously when options.live is true. Keep the
existing handleCreated and useEffect wiring intact, but ensure the pane can show
the cached PrSummary before the background refresh completes.
In `@apps/desktop/src/renderer/lib/prReadCache.ts`:
- Around line 103-106: The targeted refresh path in prReadCache is masking a
missing PR by falling back to the stale pr object. Update the refresh handling
around refreshPrsCoalesced in prReadCache to return and cache result as-is,
including null when the PR is no longer present, instead of using result ?? pr.
Then adjust the callers in ChatGitToolbar and ChatPrPane so they propagate a
null refresh result into local state rather than coercing it back to the old
summary.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4848ca28-f6a5-4e7e-b3a4-dff026b3aeda
⛔ Files ignored due to path filters (3)
docs/features/chat/README.mdis excluded by!docs/**docs/features/chat/composer-and-ui.mdis excluded by!docs/**docs/features/pull-requests/README.mdis excluded by!docs/**
📒 Files selected for processing (6)
apps/desktop/src/renderer/components/chat/ChatGitToolbar.test.tsxapps/desktop/src/renderer/components/chat/ChatGitToolbar.tsxapps/desktop/src/renderer/components/chat/ChatPrPane.test.tsxapps/desktop/src/renderer/components/chat/ChatPrPane.tsxapps/desktop/src/renderer/lib/prReadCache.test.tsapps/desktop/src/renderer/lib/prReadCache.ts
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82d80df210
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Describe the change.
What Changed
Key files and behaviors.
Validation
How you tested.
Risks
Anything to watch.
Summary by CodeRabbit
New Features
Bug Fixes
Greptile Summary
Adds targeted live refresh for linked PRs in the chat surfaces (
ChatGitToolbar,ChatPrPane) using a new coalesced, cooldown-throttledrefreshLinkedPrCoalescedcache function inprReadCache.ts. Check indicators are now suppressed for terminal PR states (merged/closed) to avoid stale CI labels.prReadCache.ts: IntroducesrefreshLinkedPrCoalescedwith a 5-second module-level cooldown (linkedPrRecentRefresh) and in-flight deduplication; errors are cached (returning the input PR) so that transient failures don't trigger repeated API hammering.ChatPrPane.tsx: Replaces directsetPrwith asetCurrentPrwrapper that syncs acurrentPrIdRefref, avoiding stale closure captures in theprs-updatedevent handler; live refresh runs on mount and theprs-updatedhandler switches tosetCurrentPr(null)when the batch contains no PR for the current lane.ChatGitToolbar.tsx: Adds a targeted live-refresh effect triggered whenprPaneOpenorprMenuOpenopens;checksIconreceives the PR state and returnsnullfor non-open/draft states.Confidence Score: 5/5
Safe to merge — the live-refresh path is well-isolated behind the existing request-cancellation pattern and a module-level cooldown, and the two open concerns (partial-batch PR clearing and onEvent re-registration) were flagged in a prior review round and have not worsened.
Both ChatPrPane and ChatGitToolbar use the new refreshLinkedPrCoalesced correctly: request IDs guard against stale writes, the cooldown prevents repeated API hammering, and the checks-icon state gate is a clean improvement. The two behaviors already under discussion from the previous review — the prs-updated else-branch clearing on partial batches and the linkedPr dep causing subscription churn in ChatGitToolbar — are unchanged from what was already reviewed. New tests cover the lane-switch race condition and throttling logic thoroughly.
ChatGitToolbar.tsx retains linkedPr in the onEvent effect dependency array (flagged previously); ChatPrPane.tsx retains the else { setCurrentPr(null) } branch on partial prs-updated batches (also flagged previously).
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant UI as ChatGitToolbar / ChatPrPane participant Cache as prReadCache participant IPC as window.ade.prs UI->>IPC: getForLane(laneId) IPC-->>UI: cached PrSummary UI->>Cache: "refreshLinkedPrCoalesced(pr, { projectRoot })" alt within 5s cooldown Cache-->>UI: freshestLinkedPr(current, recent.result) else cooldown expired / first call Cache->>IPC: "refresh({ prIds: [prId] })" IPC-->>Cache: PrSummary[] Cache->>Cache: linkedPrRecentRefresh.set(key, result) Cache-->>UI: "result (PrSummary | null)" end UI->>UI: setCurrentPr(refreshed) IPC-->>UI: prs-updated event alt event includes lane PR or current PR id UI->>IPC: getForLane(laneId) [non-live] IPC-->>UI: PrSummary UI->>UI: setCurrentPr(pr) else no matching PR in batch UI->>UI: setCurrentPr(null) end%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant UI as ChatGitToolbar / ChatPrPane participant Cache as prReadCache participant IPC as window.ade.prs UI->>IPC: getForLane(laneId) IPC-->>UI: cached PrSummary UI->>Cache: "refreshLinkedPrCoalesced(pr, { projectRoot })" alt within 5s cooldown Cache-->>UI: freshestLinkedPr(current, recent.result) else cooldown expired / first call Cache->>IPC: "refresh({ prIds: [prId] })" IPC-->>Cache: PrSummary[] Cache->>Cache: linkedPrRecentRefresh.set(key, result) Cache-->>UI: "result (PrSummary | null)" end UI->>UI: setCurrentPr(refreshed) IPC-->>UI: prs-updated event alt event includes lane PR or current PR id UI->>IPC: getForLane(laneId) [non-live] IPC-->>UI: PrSummary UI->>UI: setCurrentPr(pr) else no matching PR in batch UI->>UI: setCurrentPr(null) endReviews (3): Last reviewed commit: "Avoid stale linked PR cooldown results" | Re-trigger Greptile