Skip to content

Commit 0252b4d

Browse files
authored
fix: accept aireview as UI rereview team
- Accept ai-review and aireview as rereview team triggers
1 parent 43342ed commit 0252b4d

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

docs/runbooks/review-requested-debug.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Use this runbook when manual re-requesting kodiai on a PR does not trigger a rev
44

55
## UI-based Re-review (Team Request)
66

7-
If you want a UI-only retrigger (no comment), request review from the team `ai-review`.
7+
If you want a UI-only retrigger (no comment), request review from the team `ai-review` (or `aireview`).
88
Kodiai treats `pull_request.review_requested` for that team as a re-review trigger.
99

1010
## 1) Confirm webhook delivery exists in GitHub
@@ -68,7 +68,7 @@ Expected outcomes:
6868

6969
If skip reason is `non-kodiai-reviewer`, confirm the re-request target is the app reviewer (`kodiai` or `kodiai[bot]`).
7070

71-
If using team-based UI retrigger, confirm the requested team is `ai-review`.
71+
If using team-based UI retrigger, confirm the requested team is `ai-review` or `aireview`.
7272

7373
## 4) Verify queue lifecycle for same delivery
7474

src/handlers/review.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,48 @@ describe("createReviewHandler review_requested gating", () => {
278278
expect(enqueued[0]?.installationId).toBe(42);
279279
});
280280

281+
test("accepts team-based rereview requests for aireview", async () => {
282+
const handlers = new Map<string, (event: WebhookEvent) => Promise<void>>();
283+
const enqueued: Array<{ installationId: number }> = [];
284+
285+
const eventRouter: EventRouter = {
286+
register: (eventKey, handler) => {
287+
handlers.set(eventKey, handler);
288+
},
289+
dispatch: async () => undefined,
290+
};
291+
292+
const jobQueue: JobQueue = {
293+
enqueue: async <T>(installationId: number) => {
294+
enqueued.push({ installationId });
295+
return undefined as T;
296+
},
297+
getQueueSize: () => 0,
298+
getPendingCount: () => 0,
299+
};
300+
301+
createReviewHandler({
302+
eventRouter,
303+
jobQueue,
304+
workspaceManager: {} as WorkspaceManager,
305+
githubApp: { getAppSlug: () => "kodiai" } as GitHubApp,
306+
executor: {} as never,
307+
logger: createNoopLogger(),
308+
});
309+
310+
const handler = handlers.get("pull_request.review_requested");
311+
expect(handler).toBeDefined();
312+
313+
await handler!(
314+
buildReviewRequestedEvent({
315+
requested_team: { name: "aireview", slug: "aireview" },
316+
}),
317+
);
318+
319+
expect(enqueued).toHaveLength(1);
320+
expect(enqueued[0]?.installationId).toBe(42);
321+
});
322+
281323
test("skips malformed reviewer payloads without throwing", async () => {
282324
const handlers = new Map<string, (event: WebhookEvent) => Promise<void>>();
283325
let enqueueCount = 0;

src/handlers/review.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ function normalizeReviewerLogin(login: string): string {
4444
*
4545
* Trigger model: initial review events plus explicit re-request only.
4646
* Re-requested reviews run only when kodiai itself is the requested reviewer.
47-
* Additionally, a team-based re-request is supported for the special team slug/name "ai-review"
47+
* Additionally, a team-based re-request is supported for a special rereview team
48+
* ("ai-review" / "aireview") to enable UI-only re-review without a comment.
4849
* to enable UI-only re-review without a comment.
4950
* Clones the repo, builds a review prompt, runs Claude via the executor,
5051
* and optionally submits a silent approval if no issues were found.
@@ -59,7 +60,7 @@ export function createReviewHandler(deps: {
5960
}): void {
6061
const { eventRouter, jobQueue, workspaceManager, githubApp, executor, logger } = deps;
6162

62-
const rereviewTeamSlugs = new Set(["ai-review"]);
63+
const rereviewTeamSlugs = new Set(["ai-review", "aireview"]);
6364

6465
async function ensureUiRereviewTeamRequested(options: {
6566
octokit: Awaited<ReturnType<GitHubApp["getInstallationOctokit"]>>;

0 commit comments

Comments
 (0)