Repository navigation
Fix hidden sidebar PR polling - #4820
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR decouples pull-request polling from git-status watching by adding a new ChangesPR Watching Disable Feature (showPullRequests/CMUX_NO_PR_WATCH)
Sequence DiagramssequenceDiagram
participant Shell as Shell Integration
participant ENV as Environment<br/>(CMUX_NO_PR_WATCH)
participant GH as gh pr CLI
participant Hint as PR Hint Handler
participant Poll as PR Poll Loop
Shell->>ENV: Check CMUX_NO_PR_WATCH
alt CMUX_NO_PR_WATCH=1
Shell->>Hint: _cmux_emit_pr_command_hint returns early
Shell->>Shell: _cmux_report_pr_for_path clears cache, returns
Shell->>Poll: _cmux_start_pr_poll_loop stops loop, returns
else CMUX_NO_PR_WATCH not set
Shell->>GH: Execute gh pr list/checks
Shell->>Hint: Send report_pr_action
Shell->>Poll: Start background polling
end
sequenceDiagram
participant TabMgr as TabManager
participant State as sidebarPullRequestPollingEnabled
participant Handlers as Settings Change Handlers
participant Refresh as PR Refresh Pipeline
participant Terminal as TerminalController
participant WS as Workspace
TabMgr->>State: Track lastSidebarPullRequestPollingEnabled
TabMgr->>Handlers: sidebarMetadataSettingsDidChange()
Handlers->>Handlers: Check git-watch vs PR-polling separately
alt PR Polling Disabled
Handlers->>Refresh: sidebarPullRequestPollingSettingsDidChange()
Refresh->>Refresh: Cancel pending refreshes
Refresh->>WS: clearAllWorkspaceSidebarPullRequestMetadata()
else PR Polling Enabled
Handlers->>Refresh: Schedule/start PR refresh
end
Refresh->>Refresh: Guard on sidebarPullRequestPollingEnabled
Refresh->>Refresh: Clear PR metadata if disabled
Terminal->>Terminal: Guard PR paths on pullRequestPollingEnabled()
Terminal->>WS: Clear PR panel on guard failure
WS->>WS: clearSidebarPullRequestMetadata() separate from git clearing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
✅ Passed checks (15 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 |
Greptile SummaryThis PR gates workspace PR polling on
Confidence Score: 5/5Safe to merge — the change is a targeted gating of PR work behind the existing showPullRequests preference, with no modifications to the git-watch or branch-metadata paths. The fix correctly propagates the new pullRequestPollingEnabled flag through every PR entrypoint: the poll timer, the refresh task, the two TerminalController shell commands, applyGitProbeSnapshot, and the startup environment. Branch metadata is preserved across the toggle. The re-enable path is exercised by the second new test. No data loss, no timing hazards, and no actor-isolation issues introduced. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[UserDefaults change] --> B[sidebarMetadataSettingsDidChange]
B --> C[sidebarGitMetadataWatchSettingsDidChange]
B --> D[sidebarPullRequestPollingSettingsDidChange]
D --> E{pullRequestPollingEnabled\nwatchGitStatus && showPullRequests}
E -- false --> F[resetWorkspacePullRequestRefreshState\ncancel task + clear all tracking dicts]
F --> G[clearAllWorkspaceSidebarPullRequestMetadata\npanelPullRequests + pullRequest cleared\npanelGitBranches preserved]
E -- true --> H[refreshTrackedWorkspacePullRequestsIfNeeded\nrearmed from panelGitBranches]
subgraph Terminal Startup
I[applyManagedGitWatchEnvironment\nwatchGitStatus + showPullRequests] --> J[CMUX_NO_GIT_WATCH]
I --> K[CMUX_NO_PR_WATCH]
end
subgraph Shell Integration
K -- ==1 --> L[_cmux_start_pr_poll_loop\nstop loop and return]
K -- ==1 --> M[_cmux_report_pr_for_path\nclear cache and return]
K -- ==1 --> N[_cmux_emit_pr_command_hint\nreturn early]
end
subgraph TerminalController
O[report_pr / report_pr_action] --> P{pullRequestPollingEnabled}
P -- false --> Q[clearPanelPullRequest]
P -- true --> R[update / schedule PR refresh]
end
Reviews (2): Last reviewed commit: "test: cover PR polling reenable" | Re-trigger Greptile |
Summary
sidebar.showPullRequestsas well assidebar.watchGitStatusCMUX_NO_PR_WATCHinto shell startup and make legacy bash/zsh PR probes honor itFixes #2746.
Regression structure
gh pr viewprobes.Testing
Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.Note
Low Risk
Behavioral change is scoped to sidebar PR visibility and shell metadata; branch/git watch paths stay separate, with targeted regression tests.
Overview
PR polling and shell-side
gh prprobing now require bothsidebar.watchGitStatusandsidebar.showPullRequests, instead of treating git watch alone as enough to drive PR work.When PR rows are hidden, the app stops timers and clears PR badges while keeping branch metadata.
TabManagerreacts toshowPullRequeststoggles separately from disabling all git watch, and terminalreport_pr/report_pr_actionpaths use the new gate. Startup setsCMUX_NO_PR_WATCH(alongside existing git watch env), and bash/zsh integrations skip PR poll loops, command hints, and legacygh pr viewprobes when it is set.Regression tests cover hidden-sidebar polling, settings toggles, env wiring, and no-
ghwhen PR watch is off.Reviewed by Cursor Bugbot for commit ca60fc8. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Stop polling for pull requests when the PR section is hidden in the sidebar. Re‑enabling PRs resumes polling from preserved branch data. Fixes #2746.
sidebar.watchGitStatusandsidebar.showPullRequests.CMUX_NO_PR_WATCHin startup env; bash/zsh integrations skip legacygh prprobes and PR poll loops when set.Written for commit ca60fc8. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Tests