Repository navigation
Follow a branch to its newer pull request after the linked one settles - #6684
Merged
ymichael merged 1 commit intoOct 30, 2026
Merged
Conversation
Since #6143 each environment keeps a saved link to its PR and re-reads that URL, rediscovering only when the branch name changes. A thread that opened a second PR from the same branch after its first one merged stayed on the merged PR. Before #6143 every read ran gh pr view, which prefers an open PR. A saved link to a merged or closed PR now loads by branch instead of by URL, so the load switches to a newer PR when there is one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/fix-incorrect-thread-association-for-pr6596-thr_su3h8dvui7
branch
October 30, 2026 18:28
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Human comments
What was wrong
Since #6143, the GitHub PR Status plugin saves a link from each environment to its PR and re-reads that URL on later loads. It only looks up the branch again when the branch name changes. When a PR merged and the thread opened a second PR from the same branch, the environment stayed linked to the merged PR forever. For example, a thread whose branch carried merged #6596 and then open #6613 kept showing #6596. Before #6143 every load ran
gh pr viewon the current branch, which prefers an open PR.What changed
plugins/github-pr-status/store.ts: addsisSettled(environmentId), which says whether the environment's linked PR is merged or closed.staleAfterMsnow uses it.plugins/github-pr-status/server.ts:prepareLoadlooks up the branch (url: null) instead of reading the saved URL when the linked PR is settled, just as it already does after a branch change. The branch lookup prefers an open PR and otherwise returns the same settled PR, so this takes one GitHub request per load, not two.There are no wire, CLI or SDK changes.
Performance, measured against GitHub on the affected branch: a settled link's reload goes from a URL read (~760 ms, 1 rate-limit point) to a branch read (~990 ms, 3 points). Settled PRs are never polled. They reload only when a viewer sees one over an hour old, when a CLI read finds one more than 10 s old, on push, or after a turn that ran
gh. App viewers are served the cached row immediately and refreshed in the background.How you verified
server.test.tscase checks that a link to a merged PR switches to the branch's newer open PR, with exactly one host read per load. It fails before this change and passes after.pnpm exec turbo run test typecheck lint --filter=bb-plugin-bb--github-pr-statuspasses (182 tests).🤖 Generated with Claude Code