From 4cdc4639bc52f4dc73c995073216e0448ec4bcd8 Mon Sep 17 00:00:00 2001 From: Jon Saad-Falcon <41205309+jonsaadfalcon@users.noreply.github.com> Date: Tue, 24 Mar 2026 16:50:05 -0700 Subject: [PATCH 1/5] docs: add REVIEW.md with PR review instructions for Claude --- REVIEW.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 REVIEW.md diff --git a/REVIEW.md b/REVIEW.md new file mode 100644 index 00000000..d80561e7 --- /dev/null +++ b/REVIEW.md @@ -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 From 620788bee15e72074d7bfe2e3a4f5067f9fefb71 Mon Sep 17 00:00:00 2001 From: Jon Saad-Falcon <41205309+jonsaadfalcon@users.noreply.github.com> Date: Tue, 24 Mar 2026 16:53:26 -0700 Subject: [PATCH 2/5] ci: add Claude PR review workflow --- .github/workflows/claude-review.yml | 50 +++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/claude-review.yml diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml new file mode 100644 index 00000000..42732cc9 --- /dev/null +++ b/.github/workflows/claude-review.yml @@ -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 + +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 }} + model: claude-sonnet-4-6 + review_instructions: ${{ steps.review.outputs.instructions }} From 4ccec017849ef2010420ae85993bfc2bc3fa8a52 Mon Sep 17 00:00:00 2001 From: Jon Saad-Falcon <41205309+jonsaadfalcon@users.noreply.github.com> Date: Tue, 24 Mar 2026 16:53:58 -0700 Subject: [PATCH 3/5] ci: add Claude issue fixer workflow --- .github/workflows/claude-issues.yml | 74 +++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/claude-issues.yml diff --git a/.github/workflows/claude-issues.yml b/.github/workflows/claude-issues.yml new file mode 100644 index 00000000..0026b1d5 --- /dev/null +++ b/.github/workflows/claude-issues.yml @@ -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 + +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 }} + model: claude-sonnet-4-6 + direct_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 From 9dbd172950a5ef04e1a2bf3ce5893fc9b2137bde Mon Sep 17 00:00:00 2001 From: Jon Saad-Falcon <41205309+jonsaadfalcon@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:09:43 -0700 Subject: [PATCH 4/5] fix: mock config in test_init_defaults to test class-level defaults The test_init_defaults test expected OperativeAgent class defaults (temperature=0.3) but didn't mock load_config(), so when config loaded successfully it returned the global default (0.7) instead. Fix: mock load_config to raise, so the test properly validates the class-level _default_temperature/max_tokens/max_turns fallback path. Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/operators/test_operators.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/operators/test_operators.py b/tests/operators/test_operators.py index 065dc596..87e51eb4 100644 --- a/tests/operators/test_operators.py +++ b/tests/operators/test_operators.py @@ -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 From 3c2d9462ab233bfe1b4911d0ecb5fc416361523e Mon Sep 17 00:00:00 2001 From: Jon Saad-Falcon <41205309+jonsaadfalcon@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:36:33 -0700 Subject: [PATCH 5/5] fix: use correct claude-code-action input params and add id-token permission - Replace invalid `model` input with default (action auto-selects) - Replace `review_instructions`/`direct_prompt` with `prompt` (valid input) - Add `id-token: write` permission required for OIDC token fetching Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/claude-issues.yml | 4 ++-- .github/workflows/claude-review.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/claude-issues.yml b/.github/workflows/claude-issues.yml index 0026b1d5..dfbd3ff7 100644 --- a/.github/workflows/claude-issues.yml +++ b/.github/workflows/claude-issues.yml @@ -15,6 +15,7 @@ permissions: contents: write pull-requests: write issues: write + id-token: write jobs: fix: @@ -37,8 +38,7 @@ jobs: - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - model: claude-sonnet-4-6 - direct_prompt: | + prompt: | You are an automated issue fixer for the OpenJarvis repository. Follow these steps in order: ## Step 1: Diagnose diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index 42732cc9..2da7cd5b 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -17,6 +17,7 @@ permissions: contents: read pull-requests: write issues: write + id-token: write jobs: review: @@ -46,5 +47,4 @@ jobs: - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - model: claude-sonnet-4-6 - review_instructions: ${{ steps.review.outputs.instructions }} + prompt: ${{ steps.review.outputs.instructions }}