fix: fallback to app reviewer for rereview triggers#27
Conversation
If team reviewer requests fail (including aireview/ai-review alias retries), request the app user as fallback so @kodiai recheck still retriggers review without thread noise.
There was a problem hiding this comment.
Pull request overview
This PR improves the reliability of “UI-only” re-review triggers by falling back to requesting the GitHub App reviewer when the configured re-review team (and its alias) cannot be requested, ensuring @kodiai recheck can still generate an effective review_requested event.
Changes:
- Pass an app-slug-based
fallbackReviewerinto the best-effort re-review request helper from both review and mention handlers. - Extend
requestRereviewTeamBestEffortto request a fallback individual reviewer after team request attempts fail. - Add unit coverage for the fallback reviewer request behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/handlers/review.ts | Supplies fallbackReviewer when auto-requesting the UI re-review team on PR open/ready events. |
| src/handlers/mention.ts | Supplies fallbackReviewer for @kodiai review / @kodiai recheck rereview triggers. |
| src/handlers/rereview-team.ts | Adds fallback reviewer request logic after team request failures. |
| src/handlers/rereview-team.test.ts | Adds a unit test verifying fallback reviewer is requested when team requests fail. |
Comments suppressed due to low confidence (3)
src/handlers/mention.ts:29
- Unused import containsMention.
import {
type MentionEvent,
normalizeIssueComment,
normalizeReviewComment,
normalizeReviewBody,
containsMention,
stripMention,
} from "./mention-types.ts";
src/handlers/review.ts:524
- Unused variable appSlug.
const appSlug = githubApp.getAppSlug();
src/handlers/mention.ts:138
- Unused variable possibleHandles.
const possibleHandles = [appSlug, "claude"];
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const reviewer = (fallbackReviewer ?? "").trim(); | ||
| if (reviewer.length > 0) { | ||
| try { | ||
| await octokit.rest.pulls.requestReviewers({ | ||
| owner, | ||
| repo, | ||
| pull_number: prNumber, | ||
| reviewers: [reviewer], | ||
| team_reviewers: [], | ||
| }); |
There was a problem hiding this comment.
The fallback reviewer request doesn’t check whether that reviewer is already in listRequestedReviewers (users). If the team request fails and the fallback reviewer is already requested, GitHub typically returns 422 and no new review_requested event is emitted, which can make repeated recheck attempts ineffective and adds noisy warn logs. Consider extending the initial listRequestedReviewers check to also detect an already-requested fallbackReviewer (normalize/trim like elsewhere) and return alreadyRequested: true (or skip the fallback call) in that case.
Summary
aireview+ alias fallback)@kodiai recheckeffectiveVerification