Skip to content

fix(desktop): poll PR status for all open workspaces#793

Closed
Kitenite wants to merge 4 commits intomainfrom
pr-scanning-doesnt-work-well
Closed

fix(desktop): poll PR status for all open workspaces#793
Kitenite wants to merge 4 commits intomainfrom
pr-scanning-doesnt-work-well

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Jan 17, 2026

Summary

  • Adds background polling for GitHub PR status across all open worktree workspaces
  • Previously, PR status was only fetched on hover or for the active workspace
  • Polling is non-blocking with silent failures, deferred initial fetches, and 30s interval

Test plan

  • Open multiple worktree workspaces
  • Verify PR badges update automatically without hovering
  • Confirm no UI blocking or loading states from the background polling

Summary by CodeRabbit

  • New Features
    • Added automatic background monitoring of GitHub PR statuses for workspace projects, keeping status information continuously up-to-date without impacting app performance.

✏️ Tip: You can customize this high-level summary in your review settings.

Previously, GitHub PR status was only fetched when hovering over a
workspace or for the active workspace. This adds background polling
for all open worktree workspaces so PR badges update automatically.

The polling is designed to be completely non-blocking with silent
failures and deferred initial fetches.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 17, 2026

Warning

Rate limit exceeded

@Kitenite has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 54 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 538c991 and b7a4ddc.

📒 Files selected for processing (7)
  • apps/desktop/src/lib/trpc/routers/workspaces/procedures/git-status.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/github/index.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebar.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/ChangesView/ChangesView.tsx
  • apps/desktop/src/renderer/screens/main/hooks/usePRStatus/usePRStatusPolling.ts
📝 Walkthrough

Walkthrough

This PR introduces a new usePRStatusPolling hook that continuously polls GitHub PR statuses for all open worktree workspaces at 30-second intervals. The hook is mounted in WorkspaceSidebar, configured to run background queries without blocking the UI or refetching on window focus/reconnect.

Changes

Cohort / File(s) Summary
New usePRStatusPolling Hook
apps/desktop/src/renderer/screens/main/hooks/usePRStatus/usePRStatusPolling.ts
Implements polling logic: fetches grouped workspaces, filters for worktree type, sets up non-blocking queries per workspace with 30-second interval, 25-second staleTime, and silent error handling. Configured with placeholderData for seamless updates.
Hook Export
apps/desktop/src/renderer/screens/main/hooks/usePRStatus/index.ts
Exports newly created usePRStatusPolling hook alongside existing usePRStatus export.
WorkspaceSidebar Integration
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebar.tsx
Invokes usePRStatusPolling() near component render start to initialize background polling without altering existing props or return structure.

Sequence Diagram

sequenceDiagram
    actor User
    participant WS as WorkspaceSidebar
    participant Hook as usePRStatusPolling
    participant QC as Query Client
    participant WQ as getAllGrouped<br/>(Workspace Query)
    participant GH as GitHub PR<br/>Status Queries

    User->>WS: Mount Component
    WS->>Hook: Call usePRStatusPolling()
    Hook->>QC: Initialize hook
    Hook->>WQ: Fetch all grouped workspaces
    WQ-->>Hook: Return worktree workspaces
    loop Every 30 seconds
        Hook->>GH: Query PR status (per workspace)
        GH-->>Hook: Status data (or reuse placeholder)
        Hook->>QC: Update query cache silently
    end
    Note over Hook: Refetch disabled on window focus,<br/>mount, and reconnect
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hop, hop, status we'll check,
Every thirty seconds, what the heck!
GitHub PRs polled in silence deep,
While the sidebar takes its quiet leap.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description includes a summary and test plan, but is missing required template sections like Related Issues, Type of Change, Testing details, Screenshots, and Additional Notes. Follow the repository template by adding missing sections: explicitly mark the change type (Bug fix appears appropriate), provide detailed testing steps beyond the checklist, and include any additional context needed for review.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main change: adding background polling for PR status across open workspaces, which aligns with the changeset.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kitenite Kitenite closed this Jan 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

@Kitenite Kitenite deleted the pr-scanning-doesnt-work-well branch January 18, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant