Fix notification marking for merged PRs with bot comments
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.Mergednow 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 viaAccountType.Bot,[bot]suffix, or configurable username list -
Configurable automated users: Added
AUTOMATED_USERSconstant (includesvs-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:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
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 microsoft/vscode-pull-request-github#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: https://github.com/microsoft/winget-pkgs/pull/251563#issuecomment-2834287584
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>
I similarly expected this PR to be marked as done: https://github.com/bamurtaugh/theCatSaidNode/pull/2.@bamurtaugh
- 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: https://github.com/bamurtaugh/theCatSaidNode/pull/2#issuecomment-2837459689.</comment_new> <comment_new>
I can ignore comments that come from users who are outside the team, but I'm not sure I want that behavior.</comment_new>@alexr00
- Fixes microsoft/vscode-pull-request-github#6840
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.