-
Notifications
You must be signed in to change notification settings - Fork 553
fix: stop repeated GitHub PR fetch warnings for non-GitHub repos #540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: stop repeated GitHub PR fetch warnings for non-GitHub repos #540
Conversation
When opening a git repository without a GitHub remote, the server logs were spammed with warnings every 5 seconds during worktree polling: WARN [Worktree] Failed to fetch GitHub PRs: Command failed: gh pr list ... no git remotes found This happened because fetchGitHubPRs() ran `gh pr list` without first checking if the project has a GitHub remote configured. Changes: - Add per-project cache for GitHub remote status with 5-minute TTL - Check cache before attempting to fetch PRs, skip silently if no remote - Add forceRefreshGitHub parameter to clear cache on manual refresh - Pass forceRefreshGitHub when user clicks the refresh worktrees button This allows users to add a GitHub remote and immediately detect it by clicking the refresh button, while preventing log spam during normal polling for projects without GitHub remotes.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughThis PR implements a GitHub remote status caching mechanism with a 5-minute TTL to reduce repeated remote detection attempts. It introduces a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
Summary of ChangesHello @stefandevo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a persistent issue where the server logs were being flooded with warnings related to GitHub PR fetching for non-GitHub repositories. The core problem stemmed from an endpoint attempting to fetch GitHub PRs without first verifying the existence of a GitHub remote. The solution introduces a caching mechanism for GitHub remote status, allowing the system to intelligently skip PR fetching for irrelevant projects and providing a way to manually refresh this status when needed, significantly reducing log noise and improving efficiency. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
@coderabbitai pls review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This is a solid pull request that effectively addresses the issue of log spam from repeated GitHub PR fetches for non-GitHub repositories. The caching strategy is a good solution, and the implementation is clean and well-documented. Adding the forceRefreshGitHub parameter for manual refreshes is a thoughtful addition that improves user experience. I've included one suggestion to improve the accuracy of the cache's time-to-live (TTL).
|
✅ Actions performedReview triggered.
|
Use Date.now() after checkGitHubRemote() completes instead of the pre-captured timestamp to ensure accurate 5-minute TTL.
Problem
When opening a git repository that has no GitHub remote configured, the server logs are spammed with warnings every 5 seconds:
This happens because the worktree list endpoint (called every 5 seconds for polling) attempts to fetch GitHub PRs using
gh pr listwithout first checking if the project has a GitHub remote configured.Root Cause
In
apps/server/src/routes/worktree/routes/list.ts, thefetchGitHubPRs()function:ghCLI is availablegh pr listcommand directly without first checking if there's a GitHub remoteThe dedicated
/api/github/prsendpoint doesn't have this issue because it usescheckGitHubRemote()first to verify a GitHub remote exists.Solution
Added per-project caching for GitHub remote status with a 5-minute TTL:
Mapkeyed by project path storing theGitHubRemoteStatusand timestampgh pr list, check the cache for GitHub remote statusforceRefreshGitHubparameter that clears the cache when the user clicks the "Refresh worktrees" buttonChanges
apps/server/src/routes/worktree/routes/list.ts- Added caching logic andforceRefreshGitHubparameterapps/ui/src/lib/http-api-client.ts- AddedforceRefreshGitHubparameter tolistAll()apps/ui/src/types/electron.d.ts- Updated type definitionapps/ui/src/lib/electron.ts- Updated mock APIapps/ui/src/components/views/board-view/worktree-panel/hooks/use-worktrees.ts- PassforceRefreshGitHub: trueon manual refreshTesting
Git project WITHOUT GitHub remote
Git project WITH GitHub remote
Add GitHub remote after opening project
Test Results
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.