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.

feat: Make AI reviewer generic and add conversation context

LearningCircuitf4a607bb5a0a
diff --git a/.github/workflows/ai-code-reviewer.yml b/.github/workflows/ai-code-reviewer.yml
index 0a81c5949d..0613a3f432 100644
--- a/.github/workflows/ai-code-reviewer.yml
+++ b/.github/workflows/ai-code-reviewer.yml
@@ -38,6 +38,8 @@ jobs:
AI_TEMPERATURE: 0.1
AI_MAX_TOKENS: 2000
MAX_DIFF_SIZE: 800000
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ REPO_FULL_NAME: ${{ github.repository }}
run: |
# Run the AI reviewer and post the comment directly via stdin
# If the script fails, the error message will be posted as a comment
diff --git a/github/scripts/ai-reviewer.sh b/github/scripts/ai-reviewer.sh
index 4739e0a064..46e15127fd 100755
--- a/github/scripts/ai-reviewer.sh
+++ b/github/scripts/ai-reviewer.sh
@@ -41,6 +41,14 @@ Please split this PR into smaller changes for review."
exit 1
fi
+# Fetch previous AI review comments for context (if PR_NUMBER and REPO_FULL_NAME are set)
+PREVIOUS_REVIEWS=""
+if [ -n "$PR_NUMBER" ] && [ -n "$REPO_FULL_NAME" ] && [ -n "$GITHUB_TOKEN" ]; then
+ # Fetch comments that start with "## 🤖 AI Code Review"
+ PREVIOUS_REVIEWS=$(gh api "repos/$REPO_FULL_NAME/issues/$PR_NUMBER/comments" \
+ --jq '.[] | select(.body | startswith("## 🤖 AI Code Review")) | "### Previous Review (" + .created_at + "):\n" + .body + "\n---\n"' 2>/dev/null | head -c 50000 || echo "")
+fi
+
# Create the JSON request with proper escaping using jq
# Write diff to temporary file to avoid "Argument list too long" error
DIFF_FILE=$(mktemp)
@@ -54,7 +62,17 @@ Focus Areas:
- Performance: Check for inefficient algorithms, N+1 queries, missing indexes, memory issues, blocking operations
- Code Quality: Evaluate readability, maintainability, proper error handling, naming conventions, documentation
- Best Practices: Ensure adherence to coding standards, proper patterns, type safety, dead code removal
+"
+
+# Add previous reviews context if available
+if [ -n "$PREVIOUS_REVIEWS" ]; then
+ PROMPT_PREFIX="${PROMPT_PREFIX}
+Previous AI Reviews (for context on what was already reviewed):
+$PREVIOUS_REVIEWS
+"
+fi
+PROMPT_PREFIX="${PROMPT_PREFIX}
Code diff to analyze:
"
@@ -87,10 +105,12 @@ jq -n \
rm -f "$DIFF_FILE"
# Make API call to OpenRouter
+# Use generic or repo-specific referer
+REFERER_URL="https://github.com/${REPO_FULL_NAME:-unknown/repo}"
RESPONSE=$(curl -s -X POST "https://openrouter.ai/api/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
- -H "HTTP-Referer: https://github.com/LearningCircuit/local-deep-research" \
+ -H "HTTP-Referer: $REFERER_URL" \
-d @request.json)
# Clean up temporary file