Repository navigation
Refresh visible reviews automatically and stop settled merged polling - #25788
Conversation
Remove the polling toggle and its guards. Keep state-aware refresh pacing, shared in-flight reads, and explicit refresh cache bypass. Co-authored-by: ggbdpq <[email protected]>
Use one metadata refresh owner per host, report actual viewport cards and selected panels, and keep foreground discovery behind cooldown and retry gates. Preserve failure deadlines and reject superseded completions. Fence pending reads after PR mutations and share identical provider reads. Remove the separate card/panel metadata timers and keep checks detail retry state when the same panel is reopened. No polling setting remains. Co-authored-by: ggbdpq <[email protected]>
Reuse active pacing for selected foreground requests while preserving visible cooldown and retry gates. Commit foreground admission only after visibility acknowledgment, and remove obsolete Checks refresh state. Co-authored-by: ggbdpq <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe changes coalesce scoped GitHub PR and checks reads, invalidate hosted-review lookups after successful PR mutations, and revise PR refresh cadence, visibility tracking, and request ownership. They add visible hosted-review target discovery and scheduling. Checks-panel polling now uses shared status and retry policies, and retains check data after fetch failures. Hosted-review lookups can bypass fresh cached results. The changes also remove earlier checks-panel and sidebar polling flows and add tests for these paths. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to Some linked-review users may find Push unavailable after reopening a window if target discovery was skipped while hidden and no matching upstream exists. The checks-panel polling change preserves its visibility gates; the remaining conditional push blockage should be addressed or accepted before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation Issue
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
56f87a69-ff19-4424-a5ff-38b54051f103
📒 Files selected for processing (96)
src/main/github/client-pr-checks.test.tssrc/main/github/client-pr-lookup-coalescing.test.tssrc/main/github/client/check/get-pr-checks.tssrc/main/github/client/list/work-item-search-batch.tssrc/main/github/client/lookup/pr-for-branch-outcome.tssrc/main/github/client/merge/merge-pr.tssrc/main/github/client/merge/pr-auto-merge.tssrc/main/github/client/update/pr-details.tssrc/main/github/client/update/pr-ready.tssrc/main/github/client/update/pr-reviewers.tssrc/main/github/client/update/pr-state.tssrc/main/github/github-enterprise-repository.test.tssrc/main/github/github-enterprise-repository.tssrc/main/github/github-read-execution-scope.tssrc/main/github/pr-mutation-review-invalidation.test.tssrc/main/github/pr-mutation-review-invalidation.tssrc/main/github/pr-refresh-candidate-policy.tssrc/main/github/pr-refresh-coordinator-alias-coalescing.test.tssrc/main/github/pr-refresh-coordinator-completion-order.test.tssrc/main/github/pr-refresh-coordinator-error-cadence.test.tssrc/main/github/pr-refresh-coordinator-foreground-pacing.test.tssrc/main/github/pr-refresh-coordinator-visibility-policy.test.tssrc/main/github/pr-refresh-coordinator-visible-follow-up.test.tssrc/main/github/pr-refresh-coordinator.tssrc/main/github/pr-refresh-pacing.tssrc/main/github/pr-refresh-queue-drainer.tssrc/main/github/pr-refresh-queue-growth-bound.test.tssrc/main/github/pr-refresh-queue.tssrc/main/github/pr-refresh-retry-state.tssrc/main/github/pr-refresh-visibility.tssrc/main/ipc/hosted-review.test.tssrc/main/ipc/hosted-review.tssrc/main/runtime/rpc/methods/hosted-review.test.tssrc/main/runtime/rpc/methods/hosted-review.tssrc/main/runtime/runtime-hosted-review-commands.tssrc/main/source-control/hosted-review-branch-cache.test.tssrc/main/source-control/hosted-review-branch-cache.tssrc/main/source-control/hosted-review-scope-generations.tssrc/main/source-control/hosted-review.tssrc/renderer/src/app-shell/use-app-shell-services.tssrc/renderer/src/app-shell/use-visible-hosted-review-refresh.test.tsxsrc/renderer/src/app-shell/use-visible-hosted-review-refresh.tssrc/renderer/src/app-shell/use-visible-review-refresh-reporting.tssrc/renderer/src/app-shell/visible-review-reporting.test.tssrc/renderer/src/components/right-sidebar/checks-panel-pr-refresh-request.test.tssrc/renderer/src/components/right-sidebar/checks-panel-pr-refresh-request.tssrc/renderer/src/components/right-sidebar/checks-panel/checks-detail-polling-policy.test.tssrc/renderer/src/components/right-sidebar/checks-panel/checks-detail-polling-policy.tssrc/renderer/src/components/right-sidebar/checks-panel/checks-panel-polling-test-model.tssrc/renderer/src/components/right-sidebar/checks-panel/review-state-dependencies.tssrc/renderer/src/components/right-sidebar/checks-panel/use-checks-detail-timer.tssrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-context-state.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-controller-state.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-foreground-effects.test.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-foreground-effects.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-polling-stability.test.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-polling.test.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-polling.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-review-state.tsxsrc/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-polling.tssrc/renderer/src/components/right-sidebar/source-control/review/use-review-context.tssrc/renderer/src/components/right-sidebar/source-control/review/use-review-push-target.test.tsxsrc/renderer/src/components/right-sidebar/source-control/review/use-review-push-target.tssrc/renderer/src/components/sidebar/WorktreeCard.hosted-review-refresh.test.tsxsrc/renderer/src/components/sidebar/use-worktree-card-lifecycle-effects.tssrc/renderer/src/components/sidebar/worktree-list/viewport/use-visible-review-refresh.tssrc/renderer/src/components/sidebar/worktree-list/viewport/visible-refresh.test.tssrc/renderer/src/lib/window-visibility-timeout-poller.test.tssrc/renderer/src/lib/window-visibility-timeout-poller.tssrc/renderer/src/store/github/cache-model.tssrc/renderer/src/store/github/check-actions-errors.test.tssrc/renderer/src/store/github/check-actions.tssrc/renderer/src/store/github/pr-result-cache.tssrc/renderer/src/store/github/pull-request-execution.tssrc/renderer/src/store/github/refresh-event-actions.tssrc/renderer/src/store/github/refresh-routing-actions.tssrc/renderer/src/store/github/refresh-sweep-actions.tssrc/renderer/src/store/github/slice-types.tssrc/renderer/src/store/github/stale-worktree-refresh-actions.tssrc/renderer/src/store/github/visible-hosted-review-refresh-ownership.tssrc/renderer/src/store/github/visible-hosted-review-refresh-scheduler.test.tssrc/renderer/src/store/github/visible-hosted-review-refresh-scheduler.tssrc/renderer/src/store/github/visible-hosted-review-refresh-targets.test.tssrc/renderer/src/store/github/visible-hosted-review-refresh-targets.tssrc/renderer/src/store/github/worktree-refresh.tssrc/renderer/src/store/slices/github-pr-branch-fallback-results.test.tssrc/renderer/src/store/slices/github-pr-refresh-owner-routing.test.tssrc/renderer/src/store/slices/github-refresh-sweep.test.tssrc/renderer/src/store/slices/github.tssrc/renderer/src/store/slices/hosted-review-cache-state.tssrc/renderer/src/store/slices/hosted-review.tssrc/shared/github/pull-request-refresh-types.tssrc/shared/hosted-review.tssrc/shared/review-refresh-policy.test.tssrc/shared/review-refresh-policy.tssrc/shared/rpc-contract/hosted-review-params.ts
💤 Files with no reviewable changes (7)
- src/renderer/src/components/right-sidebar/checks-panel/review-state-dependencies.ts
- src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-controller-state.tsx
- src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-polling.ts
- src/renderer/src/components/right-sidebar/checks-panel-pr-refresh-request.ts
- src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-context-state.tsx
- src/renderer/src/components/right-sidebar/checks-panel-pr-refresh-request.test.ts
- src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-review-state.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
| useEffect(() => { | ||
| if ( | ||
| !isWindowVisible() || | ||
| !isBranchVisible || | ||
| isFolder || | ||
| !activeWorktreeId || | ||
| activeWorktree?.pushTarget || | ||
| !hasResolvableReviewPushTargetLink | ||
| ) { | ||
| return | ||
| } | ||
| void ensureHostedReviewPushTarget(activeWorktreeId) | ||
| }, [ | ||
| activeWorktree?.pushTarget, | ||
| activeWorktreeId, | ||
| ensureHostedReviewPushTarget, | ||
| hasResolvableReviewPushTargetLink, | ||
| isBranchVisible, | ||
| isFolder | ||
| ]) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Re-run the push-target check when the window becomes visible.
The effect reads isWindowVisible() once, and visibility is not a dependency. Consider a window that mounts the source-control panel while hidden, for example after an app start in the background. The effect returns early and does not run again when the window becomes visible. ensureHostedReviewPushTarget then stays uncalled until another dependency changes, such as a worktree switch.
The removed polling hook ran again on visibility changes, so this is a regression. Subscribe to visibilitychange inside the effect.
Proposed fix
useEffect(() => {
- if (
- !isWindowVisible() ||
- !isBranchVisible ||
+ if (
+ !isBranchVisible ||
isFolder ||
!activeWorktreeId ||
activeWorktree?.pushTarget ||
!hasResolvableReviewPushTargetLink
) {
return
}
- void ensureHostedReviewPushTarget(activeWorktreeId)
+ let done = false
+ const run = (): void => {
+ if (done || !isWindowVisible()) {
+ return
+ }
+ done = true
+ void ensureHostedReviewPushTarget(activeWorktreeId)
+ }
+ run()
+ document.addEventListener('visibilitychange', run)
+ return () => document.removeEventListener('visibilitychange', run)
}, [📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| useEffect(() => { | |
| if ( | |
| !isWindowVisible() || | |
| !isBranchVisible || | |
| isFolder || | |
| !activeWorktreeId || | |
| activeWorktree?.pushTarget || | |
| !hasResolvableReviewPushTargetLink | |
| ) { | |
| return | |
| } | |
| void ensureHostedReviewPushTarget(activeWorktreeId) | |
| }, [ | |
| activeWorktree?.pushTarget, | |
| activeWorktreeId, | |
| ensureHostedReviewPushTarget, | |
| hasResolvableReviewPushTargetLink, | |
| isBranchVisible, | |
| isFolder | |
| ]) | |
| useEffect(() => { | |
| if ( | |
| !isBranchVisible || | |
| isFolder || | |
| !activeWorktreeId || | |
| activeWorktree?.pushTarget || | |
| !hasResolvableReviewPushTargetLink | |
| ) { | |
| return | |
| } | |
| let done = false | |
| const run = (): void => { | |
| if (done || !isWindowVisible()) { | |
| return | |
| } | |
| done = true | |
| void ensureHostedReviewPushTarget(activeWorktreeId) | |
| } | |
| run() | |
| document.addEventListener('visibilitychange', run) | |
| return () => document.removeEventListener('visibilitychange', run) | |
| }, [ | |
| activeWorktree?.pushTarget, | |
| activeWorktreeId, | |
| ensureHostedReviewPushTarget, | |
| hasResolvableReviewPushTargetLink, | |
| isBranchVisible, | |
| isFolder | |
| ]) |
Co-authored-by: ggbdpq <[email protected]>
…ures Co-authored-by: ggbdpq <[email protected]>
Co-authored-by: ggbdpq <[email protected]>
ELI5
Orca was repeatedly asking GitHub about completed pull requests, including cards outside the visible list. It now refreshes the reviews you can see, stops automatic refreshes after merged checks finish, and checks again when your work changes. No polling setting is added.
What Changed
One owner refreshes branch review metadata per execution host: the main coordinator for local/SSH/WSL GitHub repositories, and a shared renderer queue for runtime-owned repositories and other review providers. Cards and Source Control no longer run separate metadata timers. The Checks panel refreshes check details separately.
Visibility means an actual card intersects the sidebar viewport, or the selected workspace has a visible Checks/Source Control panel. Overscan does not count. Visibility return/re-exposure checks stale data once behind a 10-second cooldown. HEAD/link changes, push, review creation/mutation, activation and explicit refresh still discover fresh state. Existing rate-limit and background-budget admission can delay automatic requests.
Failures preserve the last good answer and retry exponentially, without retrying faster than the normal interval. HEAD changes and alias visibility changes retain failure deadlines. Out-of-order responses cannot restart polling stopped by a newer result. Identical in-flight branch/check reads share a request; successful PR mutations invalidate the existing host-scoped generation so the next read cannot join an older lookup. Known Enterprise host authentication lasts 15 minutes; missing authentication retries after one minute.
Why
Verified the original issue with failing request-count regressions before changing production code. Reviewed the design before implementation, then used parallel adversarial reviews to find and fix response-ordering, mutation, visibility and retry races.
A single automatic visibility policy keeps active work current without making users tune a setting. A permanent host cache would hide changes from older clients; the existing found-review host TTL stays at 60 seconds, while current clients stop unnecessary scheduling. An optional cache-bypass field preserves mixed-version compatibility. Credit to @ggbdpq for the initial fix in #25774; included as commit co-author.
Linked Issue
Fixes #25746
Visual Proof
N/A — no layout or controls changed. Background behavior was checked in a hidden Electron renderer through CDP with a 100-workspace fixture: actual viewport cards were eligible, overscan was excluded, scrolling replaced the eligible set, hiding cleared it, and the selected panel remained eligible with the sidebar closed. Measured eligibility: 25 mounted cards / 15 visible; after scroll, 36 mounted / 16 visible; hidden, zero; selected panel with sidebar closed, one.
Measurements
Request counts use fake time and mocked request boundaries; they are not a live Enterprise benchmark. Policy allocations use the actual hook source with simulated React hook slots.
Testing
1,628 focused tests across 179 files pass on macOS, covering GitHub lookup/coalescing and mutations; hosted-review caches/providers; IPC/RPC compatibility; renderer cache ownership, selected aliases, visibility and retry scheduling; checks detail polling; and refresh sweeps. Regression tests include real held in-flight mutation lookups, old responses completing after newer results, empty/neutral completed checks, scrolling inside a tall lineage group, hidden-window cleanup, and HEAD changes during failure backoff, discovery after loading older persisted merged-review metadata, lazy Checks policy allocation, and real sidebar card memo/lineage integration.
pnpm tc, changed-code quality, the standalone React Doctor changed-lines gate, the full anti-slop audit, max-lines checks and the Electron production build pass on the final diff. GitHub CI passed all five Node 24 test shards, relay integration, static analysis/typechecking and Linux/Windows packaging ona06ddf607743; the separate mobile and headless persistence checks also passed. Live SSH/WSL and a live Enterprise account remain follow-up platform validation; their execution/provider boundaries have automated coverage. The test-selection evidence report is advisory and excluded from the merge gate.Review
Deliberate design review completed before implementation. Parallel Codex and Claude Opus 5.5 adversarial reviews iterated through the fixes and both ended with no remaining actionable findings. The Opus final sweep also passed 938 main/shared tests and 2,385 renderer tests; these overlap the integration coverage above. Foreground exposure retains the existing three-refreshes-per-30-seconds burst limit, cooldown and failure deadlines.
Agent skill upstream boundary
Notes
Desktop review polling only; the separate headless-server polling work in #23311 is outside this change. Host cache fallback on an upstream error can preserve a previously successful answer; older hosts retain their existing cache behavior when they do not support explicit bypass.
Checklist