From e22c5b9d64066aa5865b40fc5bed04e5642a418d Mon Sep 17 00:00:00 2001 From: Nelson Spence Date: Fri, 19 Jun 2026 15:58:22 -0500 Subject: [PATCH 1/3] Add OpenHands PR review bot --- .agents/skills/custom-codereview-guide.md | 29 ++++++++++++ .github/workflows/openhands-pr-review.yml | 56 +++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .agents/skills/custom-codereview-guide.md create mode 100644 .github/workflows/openhands-pr-review.yml diff --git a/.agents/skills/custom-codereview-guide.md b/.agents/skills/custom-codereview-guide.md new file mode 100644 index 0000000..c3624ad --- /dev/null +++ b/.agents/skills/custom-codereview-guide.md @@ -0,0 +1,29 @@ +--- +name: custom-codereview-guide +description: ordvec-specific code review guidance for OpenHands PR reviews. +triggers: + - /codereview +--- + +# ordvec Code Review Guidance + +Prioritize correctness, security, release-contract drift, and behavioral +regressions. Avoid spending review budget on style nits unless they hide a real +maintenance or correctness risk. + +For benchmark and documentation changes, verify that performance, memory, and +storage claims match the implementation and checked artifacts. A passing build +does not prove a benchmark claim. + +For loaders, persisted formats, and manifest verification, check malformed-input +handling, exact length validation, resource limits, path confinement, and +cross-dispatch consistency. Safe Rust panics from externally supplied artifacts +should be treated as bugs. + +For GitHub Actions and release changes, check least-privilege permissions, +pinned third-party actions, OIDC subject drift, required release invariants, and +whether a green workflow can hide skipped release-critical coverage. + +When reviewing generated or agent-authored changes, verify the final code and +tests directly. Do not treat PR prose, bot summaries, or previous review +comments as proof that the issue is fixed. diff --git a/.github/workflows/openhands-pr-review.yml b/.github/workflows/openhands-pr-review.yml new file mode 100644 index 0000000..c2b2cd9 --- /dev/null +++ b/.github/workflows/openhands-pr-review.yml @@ -0,0 +1,56 @@ +name: OpenHands PR Review + +# On-demand automated review. This workflow uses pull_request_target so it can +# comment on fork PRs, but it only runs when a maintainer applies the +# `review-this` label or requests the OpenHands reviewer. +on: + pull_request_target: # zizmor: ignore[dangerous-triggers] on-demand label/reviewer gate; secrets are not exposed on PR-open/synchronize + types: [labeled, ready_for_review, review_requested] + +permissions: + contents: read + +concurrency: + group: openhands-pr-review-${{ github.event.pull_request.number }} + cancel-in-progress: false + +jobs: + pr-review: + name: openhands PR review + if: | + github.event.pull_request.draft == false && ( + (github.event.action == 'labeled' && github.event.label.name == 'review-this') || + (github.event.action == 'ready_for_review' && contains(github.event.pull_request.labels.*.name, 'review-this')) || + (github.event.action == 'review_requested' && github.event.requested_reviewer.login == 'openhands-agent') + ) + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + contents: read + pull-requests: write + issues: write + steps: + - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 + with: + egress-policy: audit + + - name: Check OpenHands API key + env: + LLM_API_KEY: ${{ secrets.LLM_API_KEY }} + run: | + if [ -z "${LLM_API_KEY}" ]; then + echo "::error::Set the LLM_API_KEY repository secret before triggering OpenHands review." + exit 1 + fi + + # Keep both the action ref and the extensions checkout ref pinned to the + # same reviewed OpenHands/extensions commit. The plugin itself performs + # the PR checkout with persist-credentials disabled. + - name: Run OpenHands PR review + uses: OpenHands/extensions/plugins/pr-review@bb34a76d5230ba287cda4ea2883b5d008111575c + with: + extensions-version: bb34a76d5230ba287cda4ea2883b5d008111575c + llm-model: ${{ vars.OPENHANDS_LLM_MODEL || 'anthropic/claude-sonnet-4-5-20250929' }} + llm-base-url: ${{ vars.OPENHANDS_LLM_BASE_URL }} + llm-api-key: ${{ secrets.LLM_API_KEY }} + github-token: ${{ secrets.GITHUB_TOKEN }} From 305337e64ed21495d13b7bf90452207abac248ef Mon Sep 17 00:00:00 2001 From: Nelson Spence Date: Fri, 19 Jun 2026 16:08:07 -0500 Subject: [PATCH 2/3] Align OpenHands review triggers with docs --- .github/workflows/openhands-pr-review.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/openhands-pr-review.yml b/.github/workflows/openhands-pr-review.yml index c2b2cd9..8915645 100644 --- a/.github/workflows/openhands-pr-review.yml +++ b/.github/workflows/openhands-pr-review.yml @@ -1,11 +1,10 @@ name: OpenHands PR Review -# On-demand automated review. This workflow uses pull_request_target so it can -# comment on fork PRs, but it only runs when a maintainer applies the -# `review-this` label or requests the OpenHands reviewer. +# Automated and on-demand review. This workflow uses pull_request_target so the +# OpenHands agent can post PR review comments through GitHub Actions. on: pull_request_target: # zizmor: ignore[dangerous-triggers] on-demand label/reviewer gate; secrets are not exposed on PR-open/synchronize - types: [labeled, ready_for_review, review_requested] + types: [opened, labeled, ready_for_review, review_requested] permissions: contents: read @@ -18,11 +17,10 @@ jobs: pr-review: name: openhands PR review if: | - github.event.pull_request.draft == false && ( - (github.event.action == 'labeled' && github.event.label.name == 'review-this') || - (github.event.action == 'ready_for_review' && contains(github.event.pull_request.labels.*.name, 'review-this')) || - (github.event.action == 'review_requested' && github.event.requested_reviewer.login == 'openhands-agent') - ) + (github.event.action == 'opened' && github.event.pull_request.draft == false) || + github.event.action == 'ready_for_review' || + (github.event.action == 'labeled' && github.event.label.name == 'review-this') || + (github.event.action == 'review_requested' && github.event.requested_reviewer.login == 'openhands-agent') runs-on: ubuntu-latest timeout-minutes: 30 permissions: From 61c9b4d2a1d33c2851976aefd1ec6e953d74ab2e Mon Sep 17 00:00:00 2001 From: Nelson Spence Date: Fri, 19 Jun 2026 16:16:20 -0500 Subject: [PATCH 3/3] Restrict OpenHands review to label trigger --- .github/workflows/openhands-pr-review.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/openhands-pr-review.yml b/.github/workflows/openhands-pr-review.yml index 8915645..fc2556e 100644 --- a/.github/workflows/openhands-pr-review.yml +++ b/.github/workflows/openhands-pr-review.yml @@ -1,10 +1,11 @@ name: OpenHands PR Review -# Automated and on-demand review. This workflow uses pull_request_target so the -# OpenHands agent can post PR review comments through GitHub Actions. +# Label-triggered review. This workflow uses pull_request_target so the +# OpenHands agent can post PR review comments through GitHub Actions, but it +# only receives secrets after a maintainer applies `review-this`. on: pull_request_target: # zizmor: ignore[dangerous-triggers] on-demand label/reviewer gate; secrets are not exposed on PR-open/synchronize - types: [opened, labeled, ready_for_review, review_requested] + types: [labeled] permissions: contents: read @@ -16,17 +17,12 @@ concurrency: jobs: pr-review: name: openhands PR review - if: | - (github.event.action == 'opened' && github.event.pull_request.draft == false) || - github.event.action == 'ready_for_review' || - (github.event.action == 'labeled' && github.event.label.name == 'review-this') || - (github.event.action == 'review_requested' && github.event.requested_reviewer.login == 'openhands-agent') + if: github.event.label.name == 'review-this' runs-on: ubuntu-latest timeout-minutes: 30 permissions: contents: read pull-requests: write - issues: write steps: - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 with: