feat: detect push/pull failure in post-tool as error status#38
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds post-tool detection of git push and git pull failures in hook_runner.sh, surfacing them as 🐛 Push failed / 🐛 Pull failed status strings in the terminal title bar. Previously, these failures silently cleared back to idle.
Changes:
- Added regex-based detection of common push failure patterns (
error: failed to push,! [rejected],! [remote rejected],ERROR:) and pull failure patterns (CONFLICT,error:,fatal:,Automatic merge failed) in the post-tool handler. - Added 10 new tests covering push/pull failure variants and success (no false positive) cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
lib/hook_runner.sh |
New elif branches in post-tool status detection for push/pull failures |
tests/test-suite.sh |
10 new tests: 4 push failure variants, 1 push success, 4 pull failure variants, 1 pull success |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+465
to
+468
| status="🐛 Push failed" | ||
| elif [[ "${command_str}" =~ git[[:space:]]+pull ]] && \ | ||
| [[ "${tool_response}" =~ (CONFLICT|error:|fatal:|Automatic[[:space:]]+merge[[:space:]]+failed) ]]; then | ||
| status="🐛 Pull failed" |
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.
Summary
git pushrejection andgit pullconflict/failure in post-tool output🐛 Push failed/🐛 Pull failedstatus so the user sees the failure in the title barerror: failed to push,! [rejected],! [remote rejected],ERROR:,CONFLICT,fatal:,Automatic merge failedTest plan
Closes #14