Skip to content

fix(git): hide stale merged/closed PRs on the default branch#1966

Open
GuilhermeVieiraDev wants to merge 1 commit intopingdotgg:mainfrom
GuilhermeVieiraDev:fix/hide-stale-prs-on-default-branch
Open

fix(git): hide stale merged/closed PRs on the default branch#1966
GuilhermeVieiraDev wants to merge 1 commit intopingdotgg:mainfrom
GuilhermeVieiraDev:fix/hide-stale-prs-on-default-branch

Conversation

@GuilhermeVieiraDev
Copy link
Copy Markdown
Contributor

@GuilhermeVieiraDev GuilhermeVieiraDev commented Apr 12, 2026

What Changed

Added a filter so that merged and closed PRs are not surfaced when the current branch is the default branch (main/master). Open PRs on the default branch are still shown normally.

Why

When a PR was created with main as the head branch (e.g. a reverse merge from main into a feature branch), that merged PR would keep showing up in the sidebar status every time you were on main. This happened because findLatestPr falls back to the most recently updated PR regardless of state when no open PR exists.

On a feature branch this fallback makes sense since seeing "PR merged" is useful feedback. On the default branch it's just noise from old reverse merges that aren't relevant to the current context.

The fix checks isDefaultBranch (already available from statusDetails) and skips non-open PRs when it's true, keeping the feature branch behavior unchanged.

I ran into this while working on main for a smaller project that had an old reverse-merge PR. The merged PR kept showing up in the sidebar even though it wasn't relevant anymore.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Low Risk
Low risk: small conditional change to GitManager status PR selection plus a focused test, affecting only whether PR metadata is shown while on the default branch.

Overview
Updates GitManager remote status to suppress merged/closed PR matches when the current branch is the default branch, returning pr: null unless the latest match is still open.

Adds a regression test ensuring a merged PR with headRefName: main does not appear in status while on main.

Reviewed by Cursor Bugbot for commit dda0993. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Hide stale merged/closed PRs from manager.status when on the default branch

When isDefaultBranch is true, manager.status now returns null for status.pr if the latest PR is not in the open state. Previously, merged or closed PRs would still appear in status regardless of branch context. Behavioral Change: callers on the default branch that previously received a merged/closed PR in status.pr will now receive null.

Macroscope summarized dda0993.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 12, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bb9f0aed-d1f3-44b7-b44d-e403c9e8884c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions bot added size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 12, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 12, 2026

Approvability

Verdict: Approved

A small, self-contained bug fix that adds a simple conditional to hide merged/closed PRs when on the default branch. The change has clear intent explained in comments, limited scope (single conditional check), and includes test coverage.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant