You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(git): stop stale conflict batches after hide or cleanup - #35682
The poller that clears conflict badges (merge/rebase in progress) on inactive worktrees checked window visibility only once, before a batch started, and checked whether its effect was still current only after a probe succeeded. As a result:
A batch already running when the window was hidden kept sending conflict-operation probes (IPC/SSH/runtime RPC) for the remaining worktrees.
After the effect was retired (disabled, worktree list changed, unmount), a probe that rejected fell through to the catch and the loop kept probing the remaining worktrees.
No visible behavior changes; this removes wasted background requests.
Fix
Before each worktree probe, pollStale returns early when the effect is retired or the window is hidden. In-flight requests are not cancelled. The early return resolves normally in the coalesced runner, and runOnVisible re-runs the full batch, so badges still recover when the window becomes visible again.
Validation
Added one regression test (stale-conflict-operation-poll.test.tsx): the effect is retired while the first probe is pending, that probe rejects, and the second worktree is never probed. It fails on main (2 calls) and passes with the fix.
The polling hook now checks whether its effect is active and the window is visible before probing each stale worktree. A new test disables the hook while its first probe is pending, rejects the probe, advances timers by 10 seconds, and verifies that no additional request occurs.
Priority: Low
Merge Risk: Minimal · up to a9329
The polling change is mergeable; a hide-and-resume test would improve confidence in future changes.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Description check
The description clearly explains the problem, fix, regression test, and validation command. However, it omits required template sections, including the linked issue, visual proof or an explicit N/A ex…
Add the missing template sections. Include an actual issue link after “Fixes #”, provide visual proof or write N/A with a reason, document manual and platform testing, complete the AI Disclosure section when applicable, and address the re…
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly identifies the main change: stopping stale conflict polling when the window is hidden or the effect is cleaned up.
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.
Full details: Description check
Explanation
The description clearly explains the problem, fix, regression test, and validation command. However, it omits required template sections, including the linked issue, visual proof or an explicit N/A explanation, testing checklist details, AI disclosure, review checklist, and cross-platform or compatibility notes.
Resolution
Add the missing template sections. Include an actual issue link after “Fixes #”, provide visual proof or write N/A with a reason, document manual and platform testing, complete the AI Disclosure section when applicable, and address the review, compatibility, performance, and checklist items.
Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Add coverage for the hidden-window branch of pollStale.
The new test keeps visibilityState at 'visible' and never hides the window. It disables the hook instead. The only guard it exercises is the !active check. Removing the in-loop !isWindowVisible() check at stale-conflict-operation-poll.ts:69 would leave this test passing, because the disabled effect already stops the loop.
No test in this file covers the stated hide-and-resume behavior:
The window hides while the first probe is pending. The loop must not probe the second worktree.
The window becomes visible again. The remaining stale worktrees must be probed.
Without that coverage, a change can remove the hidden-window skip and restart probes while the window is hidden. The suite would still pass.
Keep the effect enabled. Set visibilityState to 'hidden' while the first probe is pending, resolve it, and assert that the second worktree is not probed. Then restore 'visible', trigger the same recovery path the window-visibility interval uses, and assert that the remaining worktree is probed.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: e8c57f8e-fede-446c-9760-3a371f29ac3a
Commits
Reviewing files that changed from the base of the PR and between fad768d and a932960.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The poller that clears conflict badges (merge/rebase in progress) on inactive worktrees checked window visibility only once, before a batch started, and checked whether its effect was still current only after a probe succeeded. As a result:
catchand the loop kept probing the remaining worktrees.No visible behavior changes; this removes wasted background requests.
Fix
Before each worktree probe,
pollStalereturns early when the effect is retired or the window is hidden. In-flight requests are not cancelled. The early return resolves normally in the coalesced runner, andrunOnVisiblere-runs the full batch, so badges still recover when the window becomes visible again.Validation
stale-conflict-operation-poll.test.tsx): the effect is retired while the first probe is pending, that probe rejects, and the second worktree is never probed. It fails onmain(2 calls) and passes with the fix.pnpm check:changed --maxWorkers=2passes (format, lint, typecheck, ratchets, affected unit tests).