Skip to content

[Fix] Scope worktree PR lookup to user branches#71

Merged
samzong merged 1 commit into
mainfrom
fix/worktree-pr-review-cache
May 13, 2026
Merged

[Fix] Scope worktree PR lookup to user branches#71
samzong merged 1 commit into
mainfrom
fix/worktree-pr-review-cache

Conversation

@samzong
Copy link
Copy Markdown
Owner

@samzong samzong commented May 13, 2026

What's changed?

  • Scope gmc wt --pr review lookup to the current user's pushed worktree branches.
  • Cache GitHub PR and GitLab MR lookup results for 5 minutes to reduce repeated remote calls.
  • Match review results against live local worktree branch and commit state.

Why

  • Full-repository PR listing can miss older user PRs in repositories with very large PR queues.
  • Repeated wt --pr runs should avoid unnecessary GitHub/GitLab calls while keeping local worktree state fresh.

Signed-off-by: samzong <samzong.lu@gmail.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 642f734082

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if branch == "" {
return false
}
_, err := c.runner.Run("-C", c.repoDir, "show-ref", "--verify", "--quiet", "refs/remotes/origin/"+branch)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Respect non-origin remotes when filtering pushed branches

In repositories whose review remote is not named origin—for example a single GitHub/GitLab remote named upstream or github—this hard-coded refs/remotes/origin/<branch> check makes every worktree look unpushed, so ReviewStates returns before calling detectReviewRemote/the CLI and gmc wt --pr silently shows no PR/MR data. Since reviewRemoteCandidates already supports upstream and a single arbitrary remote, the pushed-branch check should use the selected review remote (or otherwise consider non-origin remotes) rather than only origin.

Useful? React with 👍 / 👎.

@samzong samzong merged commit 9513c11 into main May 13, 2026
1 check passed
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