Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

Notifications for user-created PRs were not being marked as done after the user merged them, particularly when bots had commented after the user's last action.

Changes

  • Added merge events as meaningful user actions: EventType.Merged now counts when determining if the user was the last to interact with a PR
  • Filter bot accounts from timeline analysis: Introduced _isBot() method that identifies bots via AccountType.Bot, [bot] suffix, or configurable username list
  • Configurable automated users: Added AUTOMATED_USERS constant (includes vs-code-engineering) for maintainability

Implementation

Bot filtering applied to all timeline event types (commits, comments, reviews, merges):

private _isBot(user: { login: string, accountType?: AccountType }): boolean {
  if (user.accountType === AccountType.Bot) return true;
  if (user.login.endsWith('[bot]')) return true;
  if (NotificationsManager.AUTOMATED_USERS.includes(user.login)) return true;
  return false;
}

Now when markPullRequests() walks the timeline backwards to find meaningful events, bot actions are skipped. If the user's last meaningful action (including merges) is more recent than any non-bot user's action, the notification is marked as done.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/node/20.19.6/x64/bin/node node ./out/src/test/runTests.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>PR notification - mark notification for a created PR that was merged</issue_title>
<issue_description>Testing #6833

Here is an example that did not get marked as done when I invoked the action:

  • This is a PR that I created
  • There were several comments (most of them automated)
  • The PR got merged successfully

I would have expected for this notification to be marked as done as well but it did not.</issue_description>

<agent_instructions>ignore comments from the vs code engineering bot</agent_instructions>

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

@alexr00 I could ignore bot comments.

This looks like a real comment though: microsoft/winget-pkgs#251563 (comment)

I don't see a way to tell that that is not a meaningful comment.

@joshspicer Maybe offer a setting to filter out specific users? For our team, we'd filter out `@vs-code-engineering`, etc..

I'm not sure how difficult it is to determine the author of a "meaningful event". I feel that might not be feasible to do the GitHub API? </comment_new>
<comment_new>@bamurtaugh
I similarly expected this PR to be marked as done: bamurtaugh/theCatSaidNode#2.

  • This is a PR I created
  • There were comments from a couple users beyond my account
  • I merged the PR (meaning I would've seen the comments from those other accounts, and I was the last active user in the PR)

The notification went away both in gh.com and VS Code once I commented after the merge: bamurtaugh/theCatSaidNode#2 (comment).</comment_new>
<comment_new>@alexr00
I can ignore comments that come from users who are outside the team, but I'm not sure I want that behavior.</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits December 10, 2025 16:45
- Add EventType.Merged as a meaningful event in _getMeaningfulEventTime
- Filter out bot accounts (AccountType.Bot) from meaningful events
- Filter out users with [bot] suffix or vs-code-engineering username
- This fixes the issue where merged PRs by the current user don't get marked as done

Co-authored-by: alexr00 <[email protected]>
- Check login patterns for merge events to filter out bots
- MergedEvent.user is IActor (not IAccount), so we only check name patterns

Co-authored-by: alexr00 <[email protected]>
- Move isBot logic to a private method _isBot
- Simplify merge event handling to use _isBot
- Improve code organization and testability

Co-authored-by: alexr00 <[email protected]>
- Extract 'vs-code-engineering' to AUTOMATED_USERS constant
- Improve maintainability by making it easy to add/remove automated users
- Add documentation for the constant

Co-authored-by: alexr00 <[email protected]>
Copilot AI changed the title [WIP] Fix notification marking for merged PRs Fix notification marking for merged PRs with bot comments Dec 10, 2025
Copilot AI requested a review from alexr00 December 10, 2025 17:00
@alexr00 alexr00 marked this pull request as ready for review December 15, 2025 10:52
@alexr00 alexr00 enabled auto-merge (squash) December 15, 2025 10:52
@vs-code-engineering vs-code-engineering bot added this to the December / January 2026 milestone Dec 15, 2025
@alexr00 alexr00 merged commit 09cab6b into main Dec 15, 2025
6 checks passed
@alexr00 alexr00 deleted the copilot/fix-pr-notification-issue branch December 15, 2025 11:18
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.

PR notification - mark notification for a created PR that was merged

3 participants