Repository navigation
fix(watch-pr): distinguish fork heads during stack discovery - #664
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
Signed-off-by: Rudy Celekli <rudycelekli@users.noreply.github.com>
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.
Problem
watch-pr --stackconnects PRs by their head branch name alone. A fork PR opened frommainagainst upstreammainis therefore treated as a parent of every PR based on main, and the parent walk loops indefinitely. Open PRs #173, #176, and #330 already have that shape in this repository. Other same-named fork branches can produce unrelated stack members.Change
Read
isCrossRepositoryfromgh pr list, validate that field at the reader boundary, and use only upstream heads as possible parent branches. Stop descendant traversal at fork heads because upstream PR base refs cannot target those fork branches. Regenerate the Claude Code harness.Verification
git diff --checkpass.AI assistance: Codex implementation and local verification.
Note
Medium Risk
Changes stack discovery logic used by
--stackmode; incorrect fork handling could omit or mis-order PRs, but scope is limited to branch-matching heuristics with new regression tests.Overview
Fixes
watch-pr --stackstack discovery so fork PRs are not linked into upstream stacks by matching branch names alone.Open PR data now includes
isCrossRepositoryfromgh pr list(validated at parse time).orderStackonly treats upstream heads as possible parents when walking down the stack, and it does not traverse children through fork heads—preventing cases like a fork’smain→mainPR from becoming a parent or causing an infinite parent walk.Tests add fork/cross-repo regression cases, including a bounded subprocess check that the former hang terminates, and a stubbed
ghfixture asserting the new JSON field is requested and parsed.Reviewed by Cursor Bugbot for commit 42fdc95. Bugbot is set up for automated code reviews on this repo. Configure here.