|
7 | 7 | import { Buffer } from 'buffer'; |
8 | 8 | import * as vscode from 'vscode'; |
9 | 9 | import { COPILOT_ACCOUNTS } from '../common/comment'; |
10 | | -import { COPILOT_SWE_AGENT } from '../common/copilot'; |
| 10 | +import { COPILOT_LOGINS, COPILOT_SWE_AGENT } from '../common/copilot'; |
11 | 11 | import { emojify, ensureEmojis } from '../common/emoji'; |
12 | 12 | import Logger from '../common/logger'; |
13 | 13 | import { DataUri } from '../common/uri'; |
@@ -162,12 +162,28 @@ async function getReviewersQuickPickItems(folderRepositoryManager: FolderReposit |
162 | 162 | const teamReviewers: ITeam[] = allTeamReviewers[remoteName] ?? []; |
163 | 163 | const assignableUsers: (IAccount | ITeam)[] = [...teamReviewers]; |
164 | 164 |
|
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 | + |
167 | 170 | if (assignableUsersForRemote) { |
168 | 171 | assignableUsers.push(...assignableUsersForRemote); |
169 | 172 | } |
170 | 173 |
|
| 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 | + |
171 | 187 | // used to track logins that shouldn't be added to pick list |
172 | 188 | // e.g. author, existing and already added reviewers |
173 | 189 | const skipList: Set<string> = new Set([ |
|
0 commit comments