Skip to content

Add success handling to update_reaction job#2019

Merged
pelikhan merged 3 commits intomainfrom
copilot/update-comment-on-success
Oct 20, 2025
Merged

Add success handling to update_reaction job#2019
pelikhan merged 3 commits intomainfrom
copilot/update-comment-on-success

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 20, 2025

Problem

The update_reaction job was only creating comments when the agent failed, cancelled, timed out, or was skipped. When an agentic workflow completed successfully, no notification was posted to the activation comment, leaving users without clear feedback about successful completions.

Solution

Updated the notification system to handle both success and failure cases with appropriate messages and emojis. The update_reaction job now provides clear visibility into workflow outcomes directly in GitHub issues, pull requests, and discussions.

Changes

Message Handling

The script now distinguishes between success and failure cases:

Success:

✅ Agentic [Workflow Name](run-url) completed successfully.

Failure:

❌ Agentic [Workflow Name](run-url) failed and wasn't able to produce a result.

Other states (cancelled, skipped, timed_out) continue to show appropriate emojis and messages.

Code Updates

  • pkg/workflow/js/notify_comment_error.cjs: Added success case handling with ✅ emoji and restructured message logic to handle all agent conclusion states
  • pkg/workflow/notify_comment.go: Updated function comment and step name from "error notification" to "completion status" to reflect the broader scope
  • pkg/workflow/notify_comment_test.go: Updated test to validate the new step name

Test Coverage

Added comprehensive test file pkg/workflow/js/notify_comment_error.test.cjs with 11 tests covering:

  • All agent conclusion states (success, failure, cancelled, skipped, timed_out)
  • Both issue/PR comments (REST API) and discussion comments (GraphQL)
  • Custom comment repository handling
  • Error handling scenarios

Impact

  • No breaking changes - all existing failure handling behavior is preserved
  • 9 workflow lock files automatically updated to reflect the changes
  • Users now receive clear feedback for both successful and failed workflow runs

Testing

✅ All Go unit tests pass
✅ All JavaScript tests pass (11 new tests)
✅ Build completes successfully
✅ Code properly formatted
✅ Code review completed with no issues

Original prompt

The "update_reaction" should create a comment on a successful run if a comment id is available. Currently it only generates a comment on failures.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

- Updated notify_comment_error.cjs to handle success cases with ✅ emoji
- Changed step name from "error notification" to "completion status"
- Updated comments in notify_comment.go to reflect both success and failure handling
- Added comprehensive test coverage for all agent conclusion states (success, failure, cancelled, timed_out, skipped)
- All tests pass including new JavaScript tests and existing Go tests
- Updated workflow lock files to reflect the changes

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add comment creation on successful run Add success handling to update_reaction job Oct 20, 2025
Copilot AI requested a review from pelikhan October 20, 2025 10:54
@pelikhan pelikhan marked this pull request as ready for review October 20, 2025 10:55
@github-actions
Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request.

@pelikhan pelikhan merged commit c0280e9 into main Oct 20, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/update-comment-on-success branch October 20, 2025 11:00
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.

2 participants