-
Notifications
You must be signed in to change notification settings - Fork 8
ci: add agent reviewers #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MegaRedHand
wants to merge
9
commits into
main
Choose a base branch
from
ci/add-agent-reviewers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
174261f
feat: add claude settings turning off commit attribution
MegaRedHand 6ca4528
ci: add ChatGPT reviewer
MegaRedHand 1ea78de
ci: add Claude reviewer
MegaRedHand 6d97b7d
ci: add Kimi reviewer
MegaRedHand cc6a8f5
ci: improve PR review workflows for ethlambda
MegaRedHand a8846f5
ci: fix chatgpt code review action parameters
MegaRedHand 37f57c6
ci: bump checkout version and remove fetch-depth 0
MegaRedHand ec9c041
ci: bump claude-code-action to v1
MegaRedHand 2228501
docs: add CLAUDE.md
MegaRedHand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "attribution": { | ||
| "commit": "", | ||
| "pr": "" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| You are a senior code reviewer for ethlambda, a minimalist Lean Ethereum consensus client written in Rust. | ||
|
|
||
| Review this PR focusing on: | ||
| - Code correctness and potential bugs | ||
| - Security vulnerabilities (critical for blockchain code) | ||
| - Performance implications | ||
| - Rust best practices and idiomatic patterns | ||
| - Memory safety and proper error handling | ||
| - Code readability and maintainability | ||
|
|
||
| Consensus-layer considerations: | ||
| - Fork choice (LMD GHOST / 3SF-mini) correctness | ||
| - Attestation processing and validation | ||
| - Justification and finalization logic | ||
| - State transition functions (process_slots, process_block) | ||
| - XMSS signature verification and aggregation | ||
| - SSZ encoding/decoding correctness | ||
|
|
||
| Be concise and specific. Provide line references when suggesting changes. | ||
| If the code looks good, acknowledge it briefly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: PR Review - ChatGPT | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| chatgpt-review: | ||
| name: ChatGPT Code Review | ||
| if: | | ||
| github.event_name == 'pull_request' || | ||
| (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@chatgpt')) || | ||
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@chatgpt')) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Read review prompt | ||
| id: prompt | ||
| run: | | ||
| PROMPT=$(cat .github/prompts/pr_review.md) | ||
| echo "content<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$PROMPT" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: ChatGPT Code Review | ||
| uses: anc95/ChatGPT-CodeReview@6fdbaeafc6f9e0eaebb844f8cfafff67cb2947f0 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| MODEL: gpt-4o | ||
| LANGUAGE: English | ||
| max_tokens: 4096 | ||
| PROMPT: ${{ steps.prompt.outputs.content }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: PR Review - Claude | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| claude-review: | ||
| name: Claude Code Review | ||
| if: | | ||
| github.event_name == 'pull_request' || | ||
| (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@claude')) || | ||
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Read review prompt | ||
| id: prompt | ||
| run: | | ||
| PROMPT=$(cat .github/prompts/pr_review.md) | ||
| echo "content<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$PROMPT" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Claude Code Review | ||
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| claude_args: | | ||
| --max-turns 5 | ||
| --model claude-sonnet-4-20250514 | ||
| trigger_phrase: "@claude" | ||
| prompt: ${{ steps.prompt.outputs.content }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| name: PR Review - Kimi | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| kimi-review: | ||
| name: Kimi Code Review | ||
| if: | | ||
| github.event_name == 'pull_request' || | ||
| (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@kimi')) || | ||
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@kimi')) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Read review prompt | ||
| id: prompt | ||
| run: | | ||
| PROMPT=$(cat .github/prompts/pr_review.md) | ||
| echo "content<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$PROMPT" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Get PR diff | ||
| id: diff | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| gh pr diff ${{ github.event.pull_request.number }} > pr_diff.txt | ||
| # Truncate if too large (Kimi has context limits) | ||
| head -c 100000 pr_diff.txt > pr_diff_truncated.txt | ||
|
|
||
| - name: Kimi Code Review | ||
| id: kimi_review | ||
| env: | ||
| KIMI_API_KEY: ${{ secrets.KIMI_API_KEY }} | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| REVIEW_PROMPT: ${{ steps.prompt.outputs.content }} | ||
| run: | | ||
| if [ -z "$KIMI_API_KEY" ]; then | ||
| echo "Error: KIMI_API_KEY secret is not set" > kimi_review.txt | ||
| exit 0 | ||
| fi | ||
|
|
||
| DIFF_CONTENT=$(cat pr_diff_truncated.txt) | ||
|
|
||
| # Build the request body | ||
| REQUEST_BODY=$(jq -n \ | ||
| --arg diff "$DIFF_CONTENT" \ | ||
| --arg title "$PR_TITLE" \ | ||
| --arg prompt "$REVIEW_PROMPT" \ | ||
| '{ | ||
| "model": "moonshot-v1-128k", | ||
| "messages": [ | ||
| { | ||
| "role": "system", | ||
| "content": $prompt | ||
| }, | ||
| { | ||
| "role": "user", | ||
| "content": ("PR Title: " + $title + "\n\nDiff:\n" + $diff) | ||
| } | ||
| ], | ||
| "temperature": 0.3, | ||
| "max_tokens": 4096 | ||
| }') | ||
|
|
||
| # Try the API call | ||
| HTTP_RESPONSE=$(curl -s -w "\n%{http_code}" https://api.moonshot.ai/v1/chat/completions \ | ||
| -H "Content-Type: application/json" \ | ||
| -H "Authorization: Bearer $KIMI_API_KEY" \ | ||
| -d "$REQUEST_BODY") | ||
|
|
||
| HTTP_CODE=$(echo "$HTTP_RESPONSE" | tail -n1) | ||
| RESPONSE=$(echo "$HTTP_RESPONSE" | sed '$d') | ||
|
|
||
| if [ "$HTTP_CODE" != "200" ]; then | ||
| echo "API Error (HTTP $HTTP_CODE): $RESPONSE" > kimi_review.txt | ||
| else | ||
| # Check for API errors in response | ||
| ERROR=$(echo "$RESPONSE" | jq -r '.error.message // empty') | ||
| if [ -n "$ERROR" ]; then | ||
| echo "API Error: $ERROR" > kimi_review.txt | ||
| else | ||
| REVIEW=$(echo "$RESPONSE" | jq -r '.choices[0].message.content // "Error: Unexpected API response"') | ||
| echo "$REVIEW" > kimi_review.txt | ||
| fi | ||
| fi | ||
|
|
||
| - name: Post review comment | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| REVIEW_CONTENT=$(cat kimi_review.txt) | ||
|
|
||
| gh pr comment ${{ github.event.pull_request.number }} --body "## Kimi AI Code Review | ||
|
|
||
| $REVIEW_CONTENT | ||
|
|
||
| --- | ||
| *Automated review by Kimi (Moonshot AI)*" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes made in the provided snippet appear to be focused on setting environment variables and updating the way parameters are passed to the model for a
jobssetup. Here are my comments on the modifications and overall review guidelines:Code Correctness & Potential Bugs: The change simplifies and standardizes the input parameters for the
jobssetup. However, ensure that the case sensitivity of environment variable names likeMODELandPROMPTis handled correctly wherever they are used in other parts of the code.Security Vulnerabilities: Ensure the
OPENAI_API_KEYis securely handled and not logged or exposed. Always use secrets management best practices to protect sensitive information.Performance Implications: There are no direct performance implications in the changes shown, as these are configuration settings for job execution.
Rust Best Practices & Idiomatic Patterns: This section of code does not directly pertain to Rust coding practices but focuses on CI/CD configuration. As such, Rust best practices are not applicable here.
Memory Safety & Proper Error Handling: Not applicable for this configuration modification, but ensure in the overall application that secrets and environment variables are not causing any unforeseen memory leaks or unsafe behavior.
Code Readability & Maintainability: The refactoring makes parameter names consistent and simplifies the configuration block. This change aids readability.
Consensus-layer Considerations: Not directly applicable. Ensure that any changes in the build/test pipeline maintain the integrity of tests related to consensus layer algorithms and logic.
SSZ Encoding/Decoding & Others: Ensure all state transition function tests are up-to-date with these config changes to catch any issues early in CI/CD.
Conclusion: While the changes here are minor and seem correct, it's important they are thoroughly tested with the broader application to ensure no environment configuration issues. Additional testing might be necessary beyond what is shown to maintain security and functionality integrity across the system.