Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Repo Assist] Fix gh stack rebase skipping queued branches - #13

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/fix-rebase-skip-queued-2026-04-19-8bf0fde17fa24e75
Draft

github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/fix-rebase-skip-queued-2026-04-19-8bf0fde17fa24e75

Conversation

@github-actions

Copy link
Copy Markdown

🤖 This is an automated pull request from Repo Assist, an AI assistant.

Summary

gh stack rebase did not skip branches whose PRs are in a merge queue, while gh stack sync correctly skips them. Running gh stack rebase on 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

runRebase and continueRebase in cmd/rebase.go only skipped IsMerged() branches. The IsQueued() check used in cmd/sync.go was missing entirely.

The --onto ancestor 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 an IsQueued() skip block mirroring the IsMerged() one; update the --onto ancestor search to use IsSkipped() (which covers both merged and queued)
  • continueRebase: same fix for the --continue path

Tests Added

  • TestRebase_SkipsQueuedBranches: confirms a queued branch is skipped with an appropriate message and the next branch uses --onto trunk
  • TestRebase_QueuedBranch_UsesOnto: confirms that when a queued branch sits between active branches, the --onto mode propagates correctly through the chain (b1 → b2-queued → b3 → b4)

Test Status

Network access to proxy.golang.org and sum.golang.org is 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.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • sum.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "sum.golang.org"

See Network Configuration for more information.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@11c9a2c442e519ff2b427bf58679f5a525353f76

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]>
@github-actions github-actions Bot added automation bug Something isn't working repo-assist labels Apr 19, 2026
@github-actions github-actions Bot mentioned this pull request Apr 20, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation bug Something isn't working repo-assist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants