Skip to content

feat: detect push/pull failure in post-tool as error status#38

Merged
brianruggieri merged 3 commits into
mainfrom
feat/push-pull-failure-detection
Mar 16, 2026
Merged

feat: detect push/pull failure in post-tool as error status#38
brianruggieri merged 3 commits into
mainfrom
feat/push-pull-failure-detection

Conversation

@brianruggieri

Copy link
Copy Markdown
Owner

Summary

  • Detects git push rejection and git pull conflict/failure in post-tool output
  • Sets 🐛 Push failed / 🐛 Pull failed status so the user sees the failure in the title bar
  • Matches common failure patterns: error: failed to push, ! [rejected], ! [remote rejected], ERROR:, CONFLICT, fatal:, Automatic merge failed

Test plan

  • 10 new tests (4 push failure variants, 1 push success, 4 pull failure variants, 1 pull success)
  • All 180 tests pass
  • ShellCheck clean

Closes #14

Copilot AI review requested due to automatic review settings March 16, 2026 18:11

Copilot AI left a comment

Copy link
Copy Markdown

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 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 thread lib/hook_runner.sh
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"
@brianruggieri
brianruggieri merged commit 1841404 into main Mar 16, 2026
4 checks passed
@brianruggieri
brianruggieri deleted the feat/push-pull-failure-detection branch March 16, 2026 18:44
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.

feat: detect push/pull failure in post-tool and surface as error status

2 participants