Skip to content

feat(github): Link stacked pull requests into a GitHub stack - #2633

Merged
BYK merged 1 commit into
mainfrom
feat/github-auto-stack
Nov 3, 2026
Merged

BYK merged 1 commit into
mainfrom
feat/github-auto-stack

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

When Junior opens a PR on top of another PR's branch, the PRs form a plain base-branch chain. GitHub does not know they are a stack, so it cannot rebase them or merge them as one group. #2597 and #2598 taught the merge and conflict steps to use gh stack when a stack exists, but Junior never created one.

github_createPullRequest now links the new PR into a native GitHub stack (docs).

  • Skip when the base is the repo's default branch or the head repo is a fork. Normal PRs get no extra calls.
  • Walk down the base branches through open PRs (up to 10 levels) to find the chain.
  • If the parent PR is the top of a stack, add the new PR to that stack (POST /stacks/{n}/add). If the parent is in the middle of a stack, skip. Otherwise create a stack from the bottom PR to the top (POST /stacks).
  • The tool result returns stack: { number, pullRequests } when the link succeeds.

Stacking is optional, like requester assignment. A rejected call logs github.pull_request.stack_after_create.rejected, and an exception logs github.pull_request.stack_after_create.failed. PR creation never fails because of stacking.

Known gaps:

  • A replayed create call (the PR already exists) does not stack.
  • Junior watches only the PRs it opens. If a person owns the bottom PR, Junior does not get its merge event.

via @BYK.

--

View Session in Sentry

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 3, 2026 9:33pm UTC

Request Review

@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 3, 2026
@BYK
BYK enabled auto-merge (squash) November 3, 2026 21:37

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ba7f62a. Configure here.

@BYK
BYK merged commit f26d92f into main Nov 3, 2026
45 checks passed
@BYK
BYK deleted the feat/github-auto-stack branch November 3, 2026 21:41

This branch was successfully deployed

1 active deployment
Preview – junior-docs — ba7f62a6 Deployed Nov 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant