Skip to content

feat(ui): add Cmd+P pull request dropdown#309

Open
forketyfork wants to merge 2 commits into
mainfrom
claude/cmd-p-pr-dropdown-ydwn5
Open

feat(ui): add Cmd+P pull request dropdown#309
forketyfork wants to merge 2 commits into
mainfrom
claude/cmd-p-pr-dropdown-ydwn5

Conversation

@forketyfork
Copy link
Copy Markdown
Owner

When the focused terminal sits inside a GitHub-cloned repo, ⌘P now expands a
pill that lists open pull requests fetched via gh pr list on a worker
thread. Selecting an entry sends gh pr checkout <N> to the focused shell.
The collapsed pill shows the current branch's PR number (e.g. #123) when the
HEAD ref matches a fetched PR's head branch.

Detection of the GitHub origin and current branch is done synchronously on
the main thread from .git/config and .git/HEAD (including worktree
indirection), so the pill is hidden cheaply when the cwd is not a GitHub
repo. Listing PRs hits the network through gh, so that work runs on a
per-open std.Thread with results delivered via a mutex-guarded slot and an
atomic completion flag, matching the spirit of ADR-009.

https://claude.ai/code/session_01BUkFdLJ8vdB36bfZ13MksA

claude and others added 2 commits May 14, 2026 13:51
When the focused terminal sits inside a GitHub-cloned repo, ⌘P now expands a
pill that lists open pull requests fetched via `gh pr list` on a worker
thread. Selecting an entry sends `gh pr checkout <N>` to the focused shell.
The collapsed pill shows the current branch's PR number (e.g. #123) when the
HEAD ref matches a fetched PR's head branch.

Detection of the GitHub origin and current branch is done synchronously on
the main thread from `.git/config` and `.git/HEAD` (including worktree
indirection), so the pill is hidden cheaply when the cwd is not a GitHub
repo. Listing PRs hits the network through gh, so that work runs on a
per-open std.Thread with results delivered via a mutex-guarded slot and an
atomic completion flag, matching the spirit of ADR-009.

https://claude.ai/code/session_01BUkFdLJ8vdB36bfZ13MksA
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: cb76d7cfb4

ℹ️ 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".

Comment on lines +333 to +335
self.overlay.state != .Closed and
self.fetch_thread == null and
self.fetchIsStale(host.now_ms))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Ignore in-flight fetch when focused repo changes

When focus moves from one GitHub repo to another while a gh pr list thread is still running, this branch skips starting a fetch for the new repo (fetch_thread != null), so the old repo’s result is later applied to the new context and can be shown/used for checkout for up to the TTL window. This produces incorrect PR entries and can trigger gh pr checkout with PR numbers from the wrong repository. The update path should invalidate or discard stale thread results tied to the previous repo and immediately schedule a fetch for the newly focused repo.

Useful? React with 👍 / 👎.

Comment on lines +327 to +330
// Re-detect the repo when the focused cwd changes.
const new_cwd = host.focused_cwd;
if (cwdChanged(self.last_cwd_seen, new_cwd)) {
self.applyCwd(new_cwd);
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 Refresh current branch outside cwd transitions

The current branch is only re-read when focused_cwd changes, so the collapsed pill’s #<PR> badge goes stale after branch switches that keep the same directory (for example after selecting a PR, or running git checkout in place). This breaks the advertised behavior of showing the current branch’s PR number and can leave the UI displaying an incorrect badge until the cwd changes.

Useful? React with 👍 / 👎.

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.

2 participants