mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-30 10:52:15 +00:00
Merge pull request #110 from open-jarvis/feat/claude-github-actions
Add Claude GitHub Actions for PR review and issue fixing
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
name: Claude Issue Fixer
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, labeled]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: claude-issues-${{ github.event.issue.number || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
fix:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
if: |
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(github.event_name == 'issues' &&
|
||||
(contains(github.event.issue.labels.*.name, 'bug') ||
|
||||
contains(github.event.issue.labels.*.name, 'autofix'))) ||
|
||||
(github.event_name == 'issue_comment' &&
|
||||
!github.event.issue.pull_request &&
|
||||
contains(github.event.comment.body, '@claude') &&
|
||||
github.actor != 'claude[bot]')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: anthropics/claude-code-action@v1
|
||||
with:
|
||||
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
prompt: |
|
||||
You are an automated issue fixer for the OpenJarvis repository. Follow these steps in order:
|
||||
|
||||
## Step 1: Diagnose
|
||||
Read the issue thoroughly. Explore the codebase to understand the problem. If this is a bug report, attempt to reproduce it. Identify the root cause and affected files.
|
||||
|
||||
## Step 2: Comment your plan
|
||||
BEFORE making any code changes, post a comment on this issue describing:
|
||||
- Your root cause analysis
|
||||
- Which files need to change and why
|
||||
- Your implementation approach
|
||||
|
||||
## Step 3: Implement
|
||||
Create a branch named `claude/issue-${{ github.event.issue.number }}` and make the changes. Use conventional commit messages that reference the issue, e.g.:
|
||||
`fix: handle empty tool responses in orchestrator (fixes #${{ github.event.issue.number }})`
|
||||
|
||||
## Step 4: Test
|
||||
Run these commands and ensure both pass:
|
||||
- `uv run ruff check src/ tests/` (linting)
|
||||
- `uv run pytest tests/ -v --tb=short` (tests)
|
||||
|
||||
If tests fail, fix the issues before proceeding. If you added new functionality, add corresponding tests in `tests/` mirroring the `src/` directory structure.
|
||||
|
||||
## Step 5: Open PR
|
||||
Create a pull request that:
|
||||
- Links back to this issue (include `Fixes #${{ github.event.issue.number }}` in the PR body)
|
||||
- Describes what was changed and why
|
||||
- Includes a summary of test results
|
||||
|
||||
## If you cannot fix it
|
||||
If you cannot reproduce the issue, cannot determine the root cause, or the fix is beyond your capabilities, post a comment explaining:
|
||||
- What you investigated
|
||||
- What you found (or didn't find)
|
||||
- What additional information you need from the reporter
|
||||
@@ -0,0 +1,50 @@
|
||||
name: Claude PR Review
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_review_comment:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: claude-review-${{ github.event.pull_request.number || github.event.issue.number || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
issues: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
review:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
if: |
|
||||
github.event_name == 'pull_request' ||
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(github.event_name == 'issue_comment' &&
|
||||
github.event.issue.pull_request &&
|
||||
contains(github.event.comment.body, '@claude') &&
|
||||
github.actor != 'claude[bot]') ||
|
||||
(github.event_name == 'pull_request_review_comment' &&
|
||||
contains(github.event.comment.body, '@claude') &&
|
||||
github.actor != 'claude[bot]')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Read review instructions
|
||||
id: review
|
||||
run: |
|
||||
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
|
||||
echo "instructions<<$EOF" >> "$GITHUB_OUTPUT"
|
||||
cat REVIEW.md >> "$GITHUB_OUTPUT"
|
||||
echo "$EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- uses: anthropics/claude-code-action@v1
|
||||
with:
|
||||
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
prompt: ${{ steps.review.outputs.instructions }}
|
||||
@@ -0,0 +1,42 @@
|
||||
# OpenJarvis PR Review Instructions
|
||||
|
||||
You are reviewing pull requests for OpenJarvis, a local-first personal AI agent framework built with Python, Rust (PyO3), and TypeScript.
|
||||
|
||||
## Review Checklist
|
||||
|
||||
Evaluate every PR against these criteria:
|
||||
|
||||
### 1. Relevance
|
||||
Is this PR doing something useful? Valid contributions include: bug fixes, new features, feature expansions, documentation improvements, test coverage, and performance improvements. Flag PRs that appear to be empty, auto-generated without substance, or unrelated to the project.
|
||||
|
||||
### 2. Completeness
|
||||
Does the code actually implement what the PR title and description claim? If the PR says "fix X", verify X is actually fixed. If it says "add Y", verify Y is fully added and functional — not partially implemented or stubbed out.
|
||||
|
||||
### 3. Correctness
|
||||
Check for logic errors, edge cases, and off-by-one errors. Pay particular attention to:
|
||||
- **Rust-Python bridge (PyO3) boundaries** — type conversions, error propagation, GIL handling
|
||||
- **Async/await patterns** — missing awaits, unclosed resources, blocking calls in async contexts
|
||||
- **Registry pattern compliance** — new components (engines, tools, agents, channels) must register via `ToolRegistry`, `EngineRegistry`, `AgentRegistry`, `ChannelRegistry`, etc. in `src/openjarvis/core/registry.py`
|
||||
- **Event bus integration** — new lifecycle events should use `EventBus` from `src/openjarvis/core/events.py`
|
||||
|
||||
### 4. Testing
|
||||
Does the PR include tests for new code paths? Are existing tests expected to still pass? New tools, engines, agents, and channels should have corresponding test files in `tests/` mirroring the `src/` structure.
|
||||
|
||||
### 5. Security
|
||||
Check for: hardcoded API keys or secrets, missing input validation at system boundaries (user input, external APIs), and anything that compromises local-first data isolation.
|
||||
|
||||
## Do NOT Comment On
|
||||
|
||||
- Formatting or style — Ruff handles this automatically in CI
|
||||
- Code in unchanged files outside the PR diff
|
||||
- Subjective naming preferences
|
||||
- Adding docstrings or comments to code the PR did not modify
|
||||
|
||||
## Output Format
|
||||
|
||||
- Post **inline comments** on specific lines for actionable issues
|
||||
- Post a **summary comment** containing: what the PR does, whether it achieves its stated goal, and any blocking concerns
|
||||
- Use severity levels:
|
||||
- `blocking` — must fix before merge
|
||||
- `suggestion` — consider fixing
|
||||
- `nit` — take it or leave it
|
||||
@@ -485,7 +485,11 @@ class TestOperativeAgent:
|
||||
from openjarvis.agents.operative import OperativeAgent
|
||||
|
||||
engine = FakeEngine()
|
||||
agent = OperativeAgent(engine, "test-model")
|
||||
with patch(
|
||||
"openjarvis.agents._stubs.load_config",
|
||||
side_effect=Exception("no config"),
|
||||
):
|
||||
agent = OperativeAgent(engine, "test-model")
|
||||
assert agent.agent_id == "operative"
|
||||
assert agent._temperature == 0.3
|
||||
assert agent._max_tokens == 2048
|
||||
|
||||
Reference in New Issue
Block a user