Skip to content

submit: push all active branches in a single atomic push - #555

Draft
ktravers wants to merge 1 commit into
mainfrom
ktravers/submit-single-atomic-push
Draft

ktravers wants to merge 1 commit into
mainfrom
ktravers/submit-single-atomic-push

Conversation

@ktravers

@ktravers ktravers commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Authored with Copilot. Please review very closely with high skepticism 😅

Relates to https://github.com/github/pull-requests/issues/26195

Description

When rebasing and submitting a stack, pushing each branch in isolation causes GitHub to trigger two synchronization jobs for each downstream PR in the stack (one for the base push and one for the head push). Because these sync jobs run asynchronously in no guaranteed order, approvals can be dismissed inconsistently or attributed to different commits.

This change updates gh stack submit to push all active branches together in a single atomic push (with per-branch --force-with-lease checks), matching how gh stack sync pushes rebased stacks.

Note: When a gh stack modify is pending, sequential per-branch pushes are preserved so PR base branches can be updated between pushes to avoid comparing against outdated bases.

Changes

  • cmd/submit.go: Push all active branches in a single atomic push before creating/updating PRs (falling back to sequential pushes only if a modify is pending).
  • cmd/submit_test.go: Update tests to assert atomic batch push and added TestSubmit_AtomicPushFailureCreatesNoPRs.
  • docs/src/content/docs/reference/cli.md: Document atomic push behavior in submit documentation.

How did you test this change?

Ran full test suite (go test ./...) across all packages.

Pushing each branch separately makes GitHub sync every stacked PR twice
(once for its base push, once for its head push), in no fixed order.
Push all active branches together so the server can sync each PR once,
and so the remote never holds a partially-updated stack.

Branches are still pushed one at a time when a modify is pending, since
PR bases may be stale until each PR is retargeted.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant