Skip to content

Commit 7005774

Browse files
Copilotalexr00
andcommitted
Fix Copilot reviewer selection in VS Code
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent aeed910 commit 7005774

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/github/quickPicks.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { Buffer } from 'buffer';
88
import * as vscode from 'vscode';
99
import { COPILOT_ACCOUNTS } from '../common/comment';
10-
import { COPILOT_SWE_AGENT } from '../common/copilot';
10+
import { COPILOT_LOGINS, COPILOT_SWE_AGENT } from '../common/copilot';
1111
import { emojify, ensureEmojis } from '../common/emoji';
1212
import Logger from '../common/logger';
1313
import { DataUri } from '../common/uri';
@@ -162,12 +162,28 @@ async function getReviewersQuickPickItems(folderRepositoryManager: FolderReposit
162162
const teamReviewers: ITeam[] = allTeamReviewers[remoteName] ?? [];
163163
const assignableUsers: (IAccount | ITeam)[] = [...teamReviewers];
164164

165-
// Remove the swe agent as it can't do reviews
166-
const assignableUsersForRemote = allAssignableUsers[remoteName].filter(user => user.login !== COPILOT_SWE_AGENT);
165+
// Remove the swe agent as it can't do reviews, but add the reviewer instead
166+
const originalAssignableUsers = allAssignableUsers[remoteName] ?? [];
167+
const hasCopilotSweAgent = originalAssignableUsers.some(user => user.login === COPILOT_SWE_AGENT);
168+
const assignableUsersForRemote = originalAssignableUsers.filter(user => user.login !== COPILOT_SWE_AGENT);
169+
167170
if (assignableUsersForRemote) {
168171
assignableUsers.push(...assignableUsersForRemote);
169172
}
170173

174+
// If we removed the coding agent, add the Copilot reviewer instead
175+
if (hasCopilotSweAgent) {
176+
const copilotReviewer: IAccount = {
177+
login: COPILOT_LOGINS[0], // copilot-pull-request-reviewer
178+
id: '0',
179+
url: '',
180+
avatarUrl: '',
181+
name: COPILOT_ACCOUNTS[COPILOT_LOGINS[0]]?.name ?? 'Copilot',
182+
accountType: AccountType.User
183+
};
184+
assignableUsers.push(copilotReviewer);
185+
}
186+
171187
// used to track logins that shouldn't be added to pick list
172188
// e.g. author, existing and already added reviewers
173189
const skipList: Set<string> = new Set([

0 commit comments

Comments
 (0)