Skip to content

PM-5203 approval phase ai only#44

Merged
vas3a merged 7 commits into
developfrom
PM-5203_approval-phase-ai-only
Jun 5, 2026
Merged

PM-5203 approval phase ai only#44
vas3a merged 7 commits into
developfrom
PM-5203_approval-phase-ai-only

Conversation

@vas3a

@vas3a vas3a commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces several important changes to improve the handling and reliability of AI Review and Approval phases in the challenge workflow. The main focus is to ensure that phases are only closed when all necessary AI decisions are finalized, and to correctly handle the Approval phase for AI-only challenges. Additional improvements include more robust passing score logic and enhanced test coverage.

AI Review and Approval Phase Handling:

  • Added logic to block closing the AI Review phase if there are any pending AI decisions for active contest submissions, both in ChallengeApiService and SchedulerService, ensuring that all AI decisions are finalized before phase closure. [1] [2] [3] [4]
  • For AI-only challenges, the Approval phase now skips human reviewer checks and closes on schedule, as there are no human reviewer scorecards required. [1] [2]

Review and Passing Score Logic:

  • Improved the logic for determining passing scores: for submissions with a HUMAN_OVERRIDE status, the code now checks if the score meets the minimum passing threshold instead of always marking as passing. [1] [2] [3] [4]

Challenge Finalization Logic:

  • In ChallengeCompletionService, finalization is now deferred if the Approval phase is still open or incomplete, ensuring winners are only determined after all manager overrides are applied. Also, finalizeSummations is now called after these checks. [1] [2] [3]

Testing Improvements:

  • Added comprehensive tests to verify that the AI Review phase cannot be closed with pending AI decisions, and that non-AI phases and phase openings are unaffected.

Other:

  • Added a new deploy:dev script to package.json for streamlined development deployments.

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

This PR tightens the AI Review/Approval phase lifecycle in the challenge workflow so phases don’t close (and AI-only challenges don’t finalize) until required AI decisions and approval conditions are satisfied.

Changes:

  • Block closing the AI Review phase when there are pending AI decisions, in both the API-driven phase advance path and the scheduler-driven closure path.
  • Adjust AI-only Approval phase closure behavior to skip human reviewer coverage/completion checks and close on schedule.
  • Refine AI decision passing logic by applying minPassingThreshold checks for HUMAN_OVERRIDE, and add tests around the new AI Review closure blocking.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/review/review.service.ts Adds pending-AI-decision counting and updates AI decision summary logic to incorporate minPassingThreshold.
src/challenge/challenge-api.service.ts Blocks API phase closure for AI Review when pending AI decisions exist (via a new DB query helper).
src/challenge/challenge-api.service.spec.ts Adds unit tests for the AI Review closure blocking behavior.
src/autopilot/services/scheduler.service.ts Extends scheduler phase-closure gating for AI Review (pending decisions) and adjusts Approval closure rules for AI-only challenges.
src/autopilot/services/challenge-completion.service.ts Defers AI-only finalization until Approval is closed and reorders summation finalization calls.
package.json Adds a deploy:dev script for pushing a branch-based dev-* tag.

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

Comment on lines +1049 to +1050
const minPassingThreshold = Number(row.minPassingThreshold);
const hasValidThreshold = Number.isFinite(minPassingThreshold);
Comment thread src/challenge/challenge-api.service.ts Outdated
Comment on lines +837 to +841
// Also check for pending AI decisions
const pendingAiDecisions =
await this.reviewService.getPendingAiDecisionsCount(
data.challengeId,
);
@vas3a vas3a merged commit ac21bbe into develop Jun 5, 2026
6 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.

2 participants