Skip to content

PM-5015 - ai only review mode#43

Merged
vas3a merged 1 commit into
developfrom
PM-5015_ai-only-review
May 29, 2026
Merged

PM-5015 - ai only review mode#43
vas3a merged 1 commit into
developfrom
PM-5015_ai-only-review

Conversation

@vas3a

@vas3a vas3a commented May 28, 2026

Copy link
Copy Markdown
Collaborator

https://topcoder.atlassian.net/browse/PM-5015

This pull request introduces support for finalizing "AI_ONLY" challenges, where AI decisions are used in place of human review summations to determine winners. The changes add the ability to recognize and process the new AI Review phase, ensuring that phase closure and challenge completion logic correctly handle this mode. Additionally, the pull request implements logic to rank and award winners based on AI decision scores and provides a new service method for retrieving AI decision summaries.

Support for AI_ONLY challenge finalization:

  • Added the AI_REVIEW_PHASE_NAME constant and updated all relevant imports to recognize the new phase name. [1] [2] [3] [4]
  • In ChallengeCompletionService, added detection for AI_ONLY challenges and implemented finalizeAiOnlyChallenge, which finalizes challenges based on AI decision scores, handles tie-breaking, and manages challenge cancellation when necessary. [1] [2]

Phase closure and workflow handling:

  • Updated AutopilotService to treat the AI Review phase as equivalent to the AI Screening phase for AI_ONLY challenges, ensuring phase closure logic works for both. [1] [2]
  • In SchedulerService, added logic to block closure of the AI Review phase until all configured AI workflows are complete, mirroring the screening phase's behavior. Also ensures retry attempts are managed for the new phase. [1] [2] [3]

AI decision summary retrieval:

  • Added the getAiDecisionSummaries method to ReviewService, which retrieves and processes the latest AI decisions for all contest submissions, filtering and marking passing submissions appropriately for use in AI_ONLY challenge finalization.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for finalizing "AI_ONLY" challenges, in which AI decision scores replace human review summations for ranking and awarding winners. Phase-closure and scheduler logic are extended so that the new "AI Review" phase is treated equivalently to "AI Screening" for workflow-completion gating, and a new ReviewService.getAiDecisionSummaries query feeds AI scores to ChallengeCompletionService for completion or cancellation.

Changes:

  • Introduces AI_REVIEW_PHASE_NAME constant and recognizes the "AI Review" phase in autopilot, scheduler, and completion paths.
  • Implements finalizeAiOnlyChallenge in ChallengeCompletionService (ranking, tie-breaking, cancellation, payouts) and getAiDecisionSummaries in ReviewService (latest non-PENDING decision per submission).
  • Extends SchedulerService to defer closing the AI Review phase while AI workflows are still in progress, and to clean up retry attempts for that phase.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/autopilot/constants/review.constants.ts Adds AI_REVIEW_PHASE_NAME constant.
src/autopilot/services/autopilot.service.ts Treats AI Review like AI Screening for AI workflow completion and phase closure.
src/autopilot/services/scheduler.service.ts Blocks AI Review close until AI workflows finish and clears retry attempts; reuses AI-screening defer/key helpers.
src/autopilot/services/challenge-completion.service.ts Detects AI_ONLY challenges by phase name and adds finalizeAiOnlyChallenge using AI decision scores.
src/review/review.service.ts Adds getAiDecisionSummaries raw SQL query to retrieve latest AI decisions per submission.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +827 to +847
if (inProgressAiWorkflows > 0) {
await this.deferAiScreeningPhaseClosure(
data,
inProgressAiWorkflows,
`${inProgressAiWorkflows} in-progress AI workflow run(s) detected`,
);
return;
}
} catch (error) {
const err = error as Error;
this.logger.error(
`[AI REVIEW LATE] Unable to verify AI workflow readiness for phase ${data.phaseId} on challenge ${data.challengeId}: ${err.message}`,
err.stack,
);

await this.deferAiScreeningPhaseClosure(
data,
undefined,
'unable to verify AI workflow readiness',
);
return;
Comment on lines +557 to +563
const isAiOnly = (challenge.phases ?? []).some(
(p) => p.name === AI_REVIEW_PHASE_NAME,
);

if (isAiOnly) {
return this.finalizeAiOnlyChallenge(challengeId, challenge);
}

@kkartunov kkartunov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@vas3a vas3a merged commit 3c9ae60 into develop May 29, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants