fix(add-wizard): preserve files and show recovery instructions on commit failure#18489
Merged
fix(add-wizard): preserve files and show recovery instructions on commit failure#18489
Conversation
When `git commit` fails during `gh add-wizard` (interactive mode), instead of rolling back workflow files and showing a cryptic error, the tool now: 1. Leaves the workflow files on disk and staged in git for manual recovery 2. Captures and displays git's actual error output in the error message 3. Shows clear instructions for the user to manually commit/push and create a pull request Fixes: failed to commit files: failed to commit changes: exit status 1 Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve error handling for failed file commit
fix(add-wizard): preserve files and show recovery instructions on commit failure
Feb 26, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Improves gh add-wizard failure handling when git commit fails, preserving generated workflow files and providing actionable recovery guidance instead of deleting files and returning a cryptic error.
Changes:
- Capture and surface
git commitstderr/stdout incommitChangeserrors viaCombinedOutput(). - On commit failure during PR-based workflow add, stop rolling back files and print manual recovery steps.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/cli/git.go | Captures git commit output and includes it in returned errors for better diagnostics. |
| pkg/cli/add_workflow_pr.go | Replaces rollback-on-commit-failure with user guidance and preserves staged files for manual recovery. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
dsyme
reviewed
Feb 26, 2026
|
|
||
| import ( | ||
| "errors" | ||
| "fmt" |
Contributor
Author
There was a problem hiding this comment.
Fixed in 55e2360. The "errors" import was left over after switching from errors.New to fmt.Errorf (per the reviewer's suggestion). Also removed the trailing \n from the error format string to satisfy the staticcheck ST1005 rule.
Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot stopped work on behalf of
dsyme due to an error
February 26, 2026 21:40
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.
commitChangesingit.goto capture git output for better error messagesaddWorkflowsWithPRinadd_workflow_pr.goto not rollback files when commit fails, and print helpful instructions insteaderrorsimport and trailing newline in error string that caused build failure and lint errorOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.