Repository navigation
fix(watch-pr): keep stack parents beyond the first 300 open PRs - #854
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
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.
Stack discovery in watch-pr reads the repository's open pull requests with
gh pr list --limit 300and builds the stack from that list. gh returns the newest PRs first, so once a repository has more than 300 open PRs, the oldest ones are left out. Those are usually the bottom of a stack, since the base PR is opened first. When the parent is missing,orderStackstarts the stack at the watched PR and doesn't mention the cut. Stack mode can then report the stack clear while the unseen base PR still has failing checks or unresolved threads. Queued mode can report COMPLETE after the top PR merges into a base branch that hasn't reached trunk. This repository has about 270 open PRs right now, so it is close to the limit.The fix keeps the same
gh pr listquery but stops treating a full page as complete. If gh returns exactly as many rows as the limit asked for, the reader asks again with double the limit, and repeats until the result comes back shorter than the limit. Repositories under 300 open PRs still make the same single call as before. Larger repositories get the whole open list, so the parent walk inorderStackcan reach the real bottom of the stack. Parsing and the fork-head handling are unchanged.The new
open-pulls.test.tsputs a fakeghon PATH that behaves like the real one: newest first, cut off at--limit. It serves 400 open PRs, and the watched PR's base is the oldest one. On main,discoverStackreturns only the watched PR and the test fails. With the fix it returns the parent and then the watched PR. The existing watch-pr github, cli and policy tests still pass, the regenerated harness tree passes--check, andvalidate-pluginspasses.Made with Cursor
Note
Medium Risk
Changes how open PRs are fetched for stack discovery; large repos may trigger multiple
ghcalls, but behavior for small repos is unchanged and fixes incorrect completion signaling.Reviewed by Cursor Bugbot for commit 54eac27. Bugbot is set up for automated code reviews on this repo. Configure here.