Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

ci: make AI code review opt-in via ai_code_review label only (#4955)

LearningCircuitfce5528c6be4
diff --git a/.github/workflows/ai-code-reviewer.yml b/.github/workflows/ai-code-reviewer.yml
index 7e0e9d57a9..d43860b821 100644
--- a/.github/workflows/ai-code-reviewer.yml
+++ b/.github/workflows/ai-code-reviewer.yml
@@ -1,21 +1,27 @@
name: AI Code Reviewer
+# Reviews are opt-in per PR: add the ai_code_review label to request one
+# (the label is auto-removed after the run so re-adding it re-triggers).
+# The automatic opened/synchronize/ready_for_review triggers were removed —
+# reviewing every push burned reviewer-API spend on PRs nobody asked to have
+# reviewed, and a billing outage (HTTP 402) then showed a red check on every
+# PR in the repo.
on:
pull_request:
- types: [opened, synchronize, ready_for_review, labeled]
+ types: [labeled]
-# Per-PR concurrency with cancel-in-progress: a new push (synchronize) cancels
-# the now-stale review of the previous commit, which also bounds token spend on
-# rapid pushes. Keyed on the PR number so runs for *different* PRs never cancel
-# each other — that repo-wide cancellation was the problem in the earlier
-# attempt (#3554, reverted #3599), not per-PR cancellation.
+# Per-PR concurrency with cancel-in-progress: re-adding the label while a
+# review is still running cancels the now-stale run. Keyed on the PR number
+# so runs for *different* PRs never cancel each other — that repo-wide
+# cancellation was the problem in the earlier attempt (#3554, reverted
+# #3599), not per-PR cancellation.
#
# The labeled trigger fires for *every* label added to the PR, but the job's
# `if` only proceeds when the label is ai_code_review. Without the run_id
-# suffix below, a skip-only labeled event would still enter this group, cancel
-# a real in-flight review (opened/synchronize), and then skip itself — leaving
-# the PR with no review at all. Routing those into a unique group keyed on
-# run_id means they cancel nothing; the `if` discards them quietly.
+# suffix below, a skip-only labeled event would still enter this group,
+# cancel a real in-flight review, and then skip itself — leaving the PR with
+# no review at all. Routing those into a unique group keyed on run_id means
+# they cancel nothing; the `if` discards them quietly.
concurrency:
group: >-
ai-code-review-${{ github.event.pull_request.number }}${{
@@ -32,12 +38,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
environment: ci
- # Auto-review on open / push / ready-for-review, but only for non-draft PRs
- # so work-in-progress drafts don't burn a review on every WIP push.
- # The ai_code_review label stays a manual override that works even on drafts.
- if: >-
- (github.event.action == 'labeled' && github.event.label.name == 'ai_code_review') ||
- (github.event.action != 'labeled' && github.event.pull_request.draft == false)
+ # Only the ai_code_review label triggers a review (works on drafts too);
+ # every other labeled event is discarded here.
+ if: github.event.label.name == 'ai_code_review'
permissions:
contents: read
pull-requests: write
@@ -92,7 +95,6 @@ jobs:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
FAIL_ON_REQUESTED_CHANGES: ${{ vars.FAIL_ON_REQUESTED_CHANGES || 'false' }}
DEBUG_MODE: ${{ vars.DEBUG_MODE || 'false' }}
- EVENT_ACTION: ${{ github.event.action }}
run: |
echo "Running AI code review..."
@@ -210,15 +212,11 @@ jobs:
echo "DECISION=$DECISION" >> "$GITHUB_ENV"
# Remove the ai_code_review label so re-adding it re-triggers a review.
- # Only relevant when this run was triggered by that label; on
- # opened/synchronize/ready_for_review there is no such label to remove.
- if [ "$EVENT_ACTION" = "labeled" ]; then
- echo "Removing ai_code_review label to allow easy re-triggering"
- if gh issue edit "$PR_NUMBER" --remove-label "ai_code_review" 2>/dev/null; then
- echo "Successfully removed ai_code_review label"
- else
- echo "Failed to remove ai_code_review label (may have been already removed)"
- fi
+ echo "Removing ai_code_review label to allow easy re-triggering"
+ if gh issue edit "$PR_NUMBER" --remove-label "ai_code_review" 2>/dev/null; then
+ echo "Successfully removed ai_code_review label"
+ else
+ echo "Failed to remove ai_code_review label (may have been already removed)"
fi
# If every reviewer failed, the posted comment carries only failure