Recover complex create_pull_request bundle application when signed push rejects merge topology#32405
Merged
pelikhan merged 2 commits intoMay 15, 2026
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
Fix complex create_pull_request bundle application for signed pushes
Recover complex create_pull_request bundle application when signed push rejects merge topology
May 15, 2026
Copilot created this pull request from a session on behalf of
pelikhan
May 15, 2026 14:50
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an in-flow recovery path so that bundle-transported PR branches whose history contains merge commits are not lost when signed-commit replay refuses to push them. When pushSignedCommits rejects a merge-commit topology, the branch is soft-reset to origin/<base> and recommitted as a single linear commit, then the signed push is retried; the existing fallback-to-issue behavior is preserved only if the retry also fails.
Changes:
- New helper
rewriteBundleBranchAsSingleCommitthat soft-resets to the base ref, asserts staged changes exist, recommits with a derived headline, and rolls back to the original HEAD on failure. - Push-error handler now detects the specific signed-merge-replay refusal (
signedCommits && /refusing unsigned push/ && /merge commit/i), invokes the rewrite, retriespushSignedCommits, recounts new commits, and only falls through to the original fallback-issue logic when the retry also fails. - New jest test covering the rewrite + retry path and verifying no fallback issue is created.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/create_pull_request.cjs | Adds the rewriteBundleBranchAsSingleCommit helper and wraps the bundle-push catch block with merge-refusal recovery, preserving existing fallback-issue behavior under an else. |
| actions/setup/js/create_pull_request.test.cjs | Adds a unit test that mocks a signed-push merge-commit refusal followed by a successful retry, asserting the soft-reset + commit sequence and that no fallback issue is created. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 2
Comment on lines
+1518
to
+1584
| @@ -1494,6 +1581,7 @@ gh pr create --title '${title}' --base ${baseBranch} --head ${branchName} --repo | |||
| const error = `Failed to push changes and failed to create fallback issue. Push error: ${pushError instanceof Error ? pushError.message : String(pushError)}. Issue error: ${issueError instanceof Error ? issueError.message : String(issueError)}`; | |||
| return { success: false, error }; | |||
| } | |||
| } | |||
Comment on lines
+1516
to
+1518
| if (pushRecovered) { | ||
| core.info("Bundle push recovered after signed-commit rewrite"); | ||
| } else { |
Collaborator
|
@copilot review all comments |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
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.
Bug Fix
Complex
create_pull_requestbundle payloads (including merge topology) were being applied locally but failing at signed push replay (pushSignedCommits), which forced fallback issue creation instead of opening a PR in cases like the referenced chaos run. This change adds an in-flow recovery so complex bundle changes still land as PR branches under signed-commit constraints.What was the bug?
Bundle transport preserved merge commit topology, but signed replay via
createCommitOnBranchrejects merge commits. In that path,create_pull_requesttreated the push as terminal and fell back to an issue, even when the net file changes were otherwise valid for PR creation.How did you fix it?
Added a targeted recovery path in the bundle push flow:
origin/<base>pushSignedCommitsusing the rewritten historyImplementation notes
Recovery is scoped to the bundle + signed-commit merge-refusal case and does not alter normal patch flow or non-merge failures. The retry path preserves the branch target and continues through standard PR creation once push succeeds.