Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/queue/processors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3469,8 +3469,23 @@ export async function shouldStartAiReviewForAdvisory(
skipAiReview?: boolean | undefined;
},
): Promise<boolean> {
const packAllowsAnyAuthorBlockingReview = args.settings.gatePack === "oss-anti-slop" && args.settings.aiReviewMode === "block";
if (args.skipAiReview || args.settings.aiReviewMode === "off" || (!args.confirmedContributor && !packAllowsAnyAuthorBlockingReview) || !args.advisory.headSha || !isEnabled(env.AI_SUMMARIES_ENABLED) || !isEnabled(env.AI_PUBLIC_COMMENTS_ENABLED) || !env.AI) return false;
const packAllowsAnyAuthorBlockingReview =
args.settings.gatePack === "oss-anti-slop" &&
args.settings.aiReviewMode === "block";
const reviewableAuthor =
args.confirmedContributor ||
packAllowsAnyAuthorBlockingReview ||
args.settings.aiReviewAllAuthors;
if (
args.skipAiReview ||
args.settings.aiReviewMode === "off" ||
!reviewableAuthor ||
!args.advisory.headSha ||
!isEnabled(env.AI_SUMMARIES_ENABLED) ||
!isEnabled(env.AI_PUBLIC_COMMENTS_ENABLED) ||
!env.AI
)
return false;
return !(isReputationEnabled(env) && isConvergenceRepoAllowed(env, args.repoFullName) && (await shouldSkipAiForReputation(env, { project: args.repoFullName, submitter: args.author })));
}

Expand Down
7 changes: 7 additions & 0 deletions test/unit/ai-review-advisory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ describe("shouldStartAiReviewForAdvisory", () => {
await expect(shouldStartAiReviewForAdvisory(enabledEnv(), { ...base, skipAiReview: true })).resolves.toBe(false);
await expect(shouldStartAiReviewForAdvisory(enabledEnv(), { ...base, settings: { aiReviewMode: "off" } as RepositorySettings })).resolves.toBe(false);
await expect(shouldStartAiReviewForAdvisory(enabledEnv(), { ...base, confirmedContributor: false })).resolves.toBe(false);
await expect(
shouldStartAiReviewForAdvisory(enabledEnv(), {
...base,
settings: { aiReviewMode: "advisory", gatePack: "gittensor", aiReviewAllAuthors: true } as RepositorySettings,
confirmedContributor: false,
}),
).resolves.toBe(true);
await expect(shouldStartAiReviewForAdvisory(enabledEnv(), { ...base, settings: { aiReviewMode: "block", gatePack: "oss-anti-slop" } as RepositorySettings, confirmedContributor: false })).resolves.toBe(true);
const noSha = advisory();
delete (noSha as Partial<Advisory>).headSha;
Expand Down
Loading