fix: make rereview team requests resilient#24
Merged
Conversation
Normalize configured rereview team slugs and fall back between aireview/ai-review on 422 errors. Reuse this logic in both review and mention handlers so rereview triggers stay best-effort but resilient.
There was a problem hiding this comment.
Pull request overview
This PR improves the reliability of “UI re-review” team reviewer requests by centralizing the logic into a shared helper that normalizes configured team inputs (including owner/slug) and retries with the aireview/ai-review alias on GitHub 422 responses. The helper is then reused by both the review and mention handlers, with unit tests added to cover the fallback and “already requested” behavior.
Changes:
- Added a
rereview-teamhelper to normalize configured team values, detect already-requested teams, and retry with alias fallback on 422. - Updated both
reviewandmentionhandlers to use the shared helper instead of duplicating reviewer-request logic. - Added/updated tests to cover fallback + already-requested behavior and to accommodate the new API call (
listRequestedReviewers) in mention rereview tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/handlers/review.ts | Replaces inline UI rereview team request logic with shared helper call. |
| src/handlers/rereview-team.ts | Introduces shared normalization + best-effort request with 422 alias fallback and “already requested” short-circuit. |
| src/handlers/rereview-team.test.ts | Adds focused unit tests for normalization, already-requested skipping, and 422 fallback behavior. |
| src/handlers/mention.ts | Routes rereview/recheck mention flow through the shared helper. |
| src/handlers/mention.test.ts | Updates octokit mock to include listRequestedReviewers for rereview command path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aireview/ai-reviewalias fallback when GitHub returns 422Verification