Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/@types/vscode.proposed.chatParticipantAdditions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ declare module 'vscode' {
isComplete?: boolean;
toolSpecificData?: ChatTerminalToolInvocationData;
fromSubAgent?: boolean;
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;

constructor(toolName: string, toolCallId: string, isError?: boolean);
}
Expand Down
27 changes: 23 additions & 4 deletions src/notifications/notificationsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { NOTIFICATION_SETTING, NotificationVariants, PR_SETTINGS_NAMESPACE } fro
import { EventType, TimelineEvent } from '../common/timelineEvent';
import { toNotificationUri } from '../common/uri';
import { CredentialStore } from '../github/credentials';
import { NotificationSubjectType } from '../github/interface';
import { AccountType, NotificationSubjectType } from '../github/interface';
import { IssueModel } from '../github/issueModel';
import { issueMarkdown } from '../github/markdownUtils';
import { PullRequestModel } from '../github/pullRequestModel';
Expand All @@ -35,6 +35,9 @@ export enum NotificationsSortMethod {
export class NotificationsManager extends Disposable implements vscode.TreeDataProvider<NotificationTreeDataItem> {
private static ID = 'NotificationsManager';

// List of automated users that should be ignored when determining meaningful events
private static readonly AUTOMATED_USERS = ['vs-code-engineering'];

private _onDidChangeTreeData: vscode.EventEmitter<NotificationTreeDataItem | undefined | void> = this._register(new vscode.EventEmitter<NotificationTreeDataItem | undefined | void>());
readonly onDidChangeTreeData: vscode.Event<NotificationTreeDataItem | undefined | void> = this._onDidChangeTreeData.event;

Expand Down Expand Up @@ -323,6 +326,22 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
}
}

private _isBot(user: { login: string, accountType?: AccountType }): boolean {
// Check if accountType indicates this is a bot
if (user.accountType === AccountType.Bot) {
return true;
}
// Check for common bot naming patterns
if (user.login.endsWith('[bot]')) {
return true;
}
// Check for specific automated users
if (NotificationsManager.AUTOMATED_USERS.includes(user.login)) {
return true;
}
return false;
}

private _getMeaningfulEventTime(event: TimelineEvent, currentUser: string, isCurrentUser: boolean): Date | undefined {
const userCheck = (testUser?: string) => {
if (isCurrentUser) {
Expand All @@ -333,17 +352,17 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
};

if (event.event === EventType.Committed) {
if (userCheck(event.author.login)) {
if (!this._isBot(event.author) && userCheck(event.author.login)) {
return new Date(event.committedDate);
}
} else if (event.event === EventType.Commented) {
if (userCheck(event.user?.login)) {
if (event.user && !this._isBot(event.user) && userCheck(event.user.login)) {
return new Date(event.createdAt);
}
} else if (event.event === EventType.Reviewed) {
// We only count empty reviews as meaningful if the user is the current user
if (isCurrentUser || (event.comments.length > 0 || event.body.length > 0)) {
if (userCheck(event.user?.login)) {
if (event.user && !this._isBot(event.user) && userCheck(event.user.login)) {
return new Date(event.submittedAt);
}
}
Expand Down