Skip to content

Improve fallback issue instructions when PR creation fails#18536

Merged
dsyme merged 4 commits intomainfrom
copilot/improve-pull-request-error-instructions
Feb 26, 2026
Merged

Improve fallback issue instructions when PR creation fails#18536
dsyme merged 4 commits intomainfrom
copilot/improve-pull-request-error-instructions

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

Fallback issues created on push/PR-creation failures only showed how to download and apply the patch — leaving users to figure out branch creation and PR submission themselves.

Changes

  • Push-failed fallback: Replaced the bare git am snippet with a complete workflow — git checkout -b, git am --3way, git push, and gh pr create — with actual values (branch name, base branch, run ID, patch path, repo) interpolated from context.

  • PR-creation-failed fallback: Replaced the vague "You can manually create a pull request from the branch if needed" prose with a ready-to-run gh pr create command (title, base, head, and repo pre-filled). Reformatted the note block to use > [!NOTE] consistent with the push-failed case.

Example of new push-failed instructions:

# Download the artifact from the workflow run
gh run download 22451371409 -n agent-artifacts -D /tmp/agent-artifacts-22451371409

# Create a new branch
git checkout -b aw-my-workflow-abc123

# Apply the patch (--3way handles cross-repo patches where files may already exist)
git am --3way /tmp/agent-artifacts-22451371409/aw-my-workflow-abc123.patch

# Push the branch to origin
git push origin aw-my-workflow-abc123

# Create the pull request
gh pr create --title "My change title" --base main --head aw-my-workflow-abc123 --repo owner/repo
Original prompt

This section details on the original issue you should resolve

<issue_title>Instructions for issue created when pull request creation failed should be better</issue_title>
<issue_description>These instructions are shown on any issue created when pull request creation failed

gh run download 22451371409 -n agent-artifacts -D /tmp/agent-artifacts-22451371409

# The patch file will be at agent-artifacts/tmp/gh-aw/aw-repo-assist-rebase-pr-1341.patch after download
# Apply the patch (--3way handles cross-repo patches where files may already exist)
git am --3way /tmp/agent-artifacts-22451371409/aw-repo-assist-rebase-pr-1341.patch

These should actually show the git/gh commands to create a branch, apply the patch, create the pull request. </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Add complete git/gh commands (branch creation, patch apply, push, PR
creation) to fallback issues created when push or PR creation fails.
Fixes issue where instructions were incomplete.

Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot AI changed the title [WIP] Update instructions for failed pull request creation Improve fallback issue instructions when PR creation fails Feb 26, 2026
@dsyme dsyme marked this pull request as ready for review February 26, 2026 20:54
Copilot AI review requested due to automatic review settings February 26, 2026 20:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the fallback instructions shown to users when automated PR creation fails, providing complete step-by-step workflows instead of basic patch application commands.

Changes:

  • Enhanced push-failed fallback with complete workflow: branch creation, patch application, push, and PR creation commands
  • Updated PR-creation-failed fallback to include ready-to-run gh pr create command with pre-filled parameters
  • Standardized markdown formatting using > [!NOTE] blocks for consistency
Comments suppressed due to low confidence (1)

actions/setup/js/create_pull_request.cjs:954

  • The title variable is directly interpolated into the shell command without proper escaping. If the title contains double quotes, backticks, dollar signs, or other shell special characters, it could break the command or potentially lead to unintended command execution. Consider using single quotes instead of double quotes around the title, or escape shell special characters in the title before interpolation. For example: gh pr create --title '${title}' ... or properly escape the title value for shell usage.
gh pr create --title "${title}" --base ${baseBranch} --head ${branchName} --repo ${repoParts.owner}/${repoParts.repo}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dsyme dsyme merged commit aaa8932 into main Feb 26, 2026
46 checks passed
@dsyme dsyme deleted the copilot/improve-pull-request-error-instructions branch February 26, 2026 21:33
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.

Instructions for issue created when pull request creation failed should be better

3 participants