From 60f4b10398d4b02ca659ca1241e85cbcefcdee7f Mon Sep 17 00:00:00 2001 From: ghost <49853598+JSONbored@users.noreply.github.com> Date: Fri, 26 Jun 2026 18:51:51 -0700 Subject: [PATCH] fix(review): honor all-authors AI preflight --- src/queue/processors.ts | 19 +++++++++++++++++-- test/unit/ai-review-advisory.test.ts | 7 +++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/queue/processors.ts b/src/queue/processors.ts index 943c9822de..343f82d7a7 100644 --- a/src/queue/processors.ts +++ b/src/queue/processors.ts @@ -3469,8 +3469,23 @@ export async function shouldStartAiReviewForAdvisory( skipAiReview?: boolean | undefined; }, ): Promise { - 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 }))); } diff --git a/test/unit/ai-review-advisory.test.ts b/test/unit/ai-review-advisory.test.ts index 65e7cd7b75..cc3eef3b67 100644 --- a/test/unit/ai-review-advisory.test.ts +++ b/test/unit/ai-review-advisory.test.ts @@ -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).headSha;