Repository navigation
Conversation
orderStack keyed every open PR by its head branch name. An open PR from a fork's main into main has the head name main, so it became its own parent, and the ancestor walk pushed it forever for that PR and for every PR based on main. watch-pr --stack on cursor/plugins#744 never printed and was killed by a 30-second alarm. Two PRs whose branches point at each other looped the same way. A PR whose head is in another repository is no longer a parent, and stack discovery does not look for children above it. The ancestor walk stops when it reaches a PR it has already taken. The gh reader now asks for isCrossRepository.
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.
watch-pr --stacknever returns in a repository that has an open PR from a fork'smainintomain. This fixes stack discovery and adds a test for each case. I left the release to you: no VERSION, manifest, or CHANGES.md change. The pins stay at88d4751.The bug
orderStackinwatch-pr/github.tskeys every open PR by its head branch name.gh pr listreports a fork PR's head as the bare branch name, so a PR fromsomeone:mainintomainis stored undermain. Any PR based onmainthen finds that fork PR as its parent, the fork PR finds itself as its own parent, and the ancestor loop pushes it forever. Watching the fork PR itself loops the same way. Two same-repository PRs whose branches point at each other (aintob,bintoa) loop too.This is common.
cursor/pluginshas three open PRs from a fork'smainright now (#173, #176, #330). Onmain, against a PR there that is based onmain:It printed nothing and was killed by the alarm. Lauren's
orderStackat88d4751has the same code.github.tsis already a declared fork here.The fix
isCrossRepository, andOpenPullRequestcarries it.The field is optional on the type so that the upstream
github.test.tskeeps compiling unchanged. The reader always sets it and fails if gh leaves it out. Thetools/forks.jsonentries forgithub.tsandtypes.tsnow name the change.After the fix, the same command:
Tests
New port-only file
watch-pr/stack.test.ts:ghthat lists a fork PR frommain, with--stack --status-only.On
mainthe threeorderStacktests never finish (each was killed by a 25-second alarm, exit 142), and the gh reader test fails:On this branch all four pass.
Checks
GIT_CONFIG_GLOBAL=/dev/null bun test tests/ --timeout 30000: 550 pass, 46 skip, 0 failbun tools/generate.mjs --check: 17 generated files current, all checks passbun run typecheckclean,GIT_CONFIG_GLOBAL=/dev/null bun test orch watch-pr check-plan.test.ts: 123 pass, 0 failbunx prettier@3.6.2 --checkpasses onstack.test.ts, andgithub.tsandtypes.tsare unchanged by Prettierbun tools/sync.mjs {pstack,cursor-team-kit,thermos} 88d4751 --dry-run: exit 0 for all three. pstack listsgithub.ts(60 changed lines) andtypes.ts(58) as declared policy forks andstack.test.tsas port-only