[Repo Assist] Fix gh stack rebase skipping queued branches - #13
Draft
github-actions[bot] wants to merge 1 commit into
Draft
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
gh stack sync correctly skips branches whose PRs are in a merge queue (they use the same --onto logic as squash-merged branches), but gh stack rebase did not. Running 'gh stack rebase' when a PR was queued would attempt to rebase the queued branch, which conflicts with the merge queue's ownership of the branch state. Changes: - runRebase: skip queued branches alongside merged ones, using IsSkipped() for the --onto ancestor search (both merged and queued branches) - continueRebase: same fix for the --continue path - Add TestRebase_SkipsQueuedBranches and TestRebase_QueuedBranch_UsesOnto Co-authored-by: Copilot <[email protected]>
20 tasks
github-actions Bot
added a commit
that referenced
this pull request
Apr 24, 2026
…sistency Three small queued-branch fixes that complement PR #13 (which adds the actual skip logic for queued branches during rebase): 1. --upstack warning: extend the 'current branch is merged' check to also warn when the current branch is queued in a merge queue. Before: silent when running 'gh stack rebase --upstack' on a queued branch. After: 'Warning: current branch "X" is currently in a merge queue'. 2. Rebase summary: add 'Skipped N queued branches: ...' to the end-of- rebase summary, matching the existing 'Skipped N merged branches' line. Users can now see which branches were skipped due to merge queue. 3. continueRebase baseBranch: use IsSkipped() instead of IsMerged() when computing the baseBranch for the success message. This ensures that queued ancestors are also skipped when looking for the nearest active parent, consistent with all other --onto target lookups in the file. These changes have no effect on current main behaviour (queued branches are not actually skipped in main until PR #13 is merged), but they ensure the output is correct once queued-skip is live. Co-authored-by: Copilot <[email protected]>
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.
🤖 This is an automated pull request from Repo Assist, an AI assistant.
Summary
gh stack rebasedid not skip branches whose PRs are in a merge queue, whilegh stack synccorrectly skips them. Runninggh stack rebaseon a stack where some PRs were queued would attempt to rebase those queued branches — which conflicts with the merge queue's ownership of the branch state and can cause force-push errors or unexpected behaviour.Root Cause
runRebaseandcontinueRebaseincmd/rebase.goonly skippedIsMerged()branches. TheIsQueued()check used incmd/sync.gowas missing entirely.The
--ontoancestor search (which finds the correct target when skipped branches precede active ones) also only excluded merged branches. It needed to exclude queued branches too.Fix
runRebase: add anIsQueued()skip block mirroring theIsMerged()one; update the--ontoancestor search to useIsSkipped()(which covers both merged and queued)continueRebase: same fix for the--continuepathTests Added
TestRebase_SkipsQueuedBranches: confirms a queued branch is skipped with an appropriate message and the next branch uses--onto trunkTestRebase_QueuedBranch_UsesOnto: confirms that when a queued branch sits between active branches, the--ontomode propagates correctly through the chain (b1 → b2-queued → b3 → b4)Test Status
Network access to
proxy.golang.organdsum.golang.orgis blocked in this environment, preventing the Go toolchain from running. The CI workflow (test.yml) will run the full test suite on GitHub. The changes are a two-block addition in a well-understood code path, mirroring the already-tested sync logic.Warning
The following domain was blocked by the firewall during workflow execution:
sum.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.