Skip to content

Add OpenHands agentic PR review - #28

Merged
wende merged 9 commits into
mainfrom
agent/openhands-pr-review
Jul 30, 2026
Merged

Add OpenHands agentic PR review#28
wende merged 9 commits into
mainfrom
agent/openhands-pr-review

Conversation

@wende

@wende wende commented Jul 29, 2026

Copy link
Copy Markdown
Owner

What changed

  • add an automatic OpenHands PR review workflow backed by MiniMax M3
  • consume the versioned wende/agentic-pr-review v1.0.0 action at its immutable release commit
  • give the reviewer full-repository inspection plus file-level sub-agent delegation
  • add Macbeth-specific review guidance for the TypeScript/Swift protocol, macOS privacy boundaries, lifecycle races, tests, and workflow security
  • pin the OpenHands extension action, disable shared dependency caching, and grant only the permissions required to post reviews
  • rerun automatically on every new commit, including updates to draft PRs

Why

The existing prompt-only reviewer is constrained by supplied diff text. OpenHands checks out the PR repository and can inspect full files, callers, tests, and prior review threads with terminal and file tools before posting inline findings.

Reviews run automatically when a same-repository PR is opened or reopened, when a draft becomes ready, and on every new commit. Concurrent runs are grouped per PR so a new commit cancels an obsolete in-progress review.

Impact

Once this workflow is merged to the default branch, every same-repository PR receives a MiniMax M3 review automatically. Each rerun reads previous reviews and threads, verifies earlier findings against the current HEAD, summarizes what was resolved or remains, and adds only fitting new inline findings. The existing MiniMax workflow remains separate.

For security, this uses the pull_request event. Repository secrets are therefore not exposed to fork PRs; reviews of fork PRs will need a separate trusted design if that becomes necessary.

Validation

  • actionlint .github/workflows/openhands-pr-review.yml
  • Ruby YAML parse
  • git diff --cached --check
  • confirmed MINIMAX_API_KEY exists in GitHub Actions secrets
  • confirmed the pinned OpenHands v0.11.0 action inputs and full-repository review behavior
  • exercised the original and packaged workflows live and verified the OpenHands SDK/tools API compatibility
  • central action contract tests and Actionlint pass in wende/agentic-pr-review

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
macbeth Ready Ready Preview Jul 30, 2026 12:30am

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Good taste — The workflow is narrowly triggered, uses least-privilege permissions, pins the OpenHands action and extension source to a verified commit older than seven days, and disables dependency caching. The repository-specific review guidance is focused and actionable.

[RISK ASSESSMENT]

  • [Overall PR] ⚠️ Risk Assessment: 🟡 MEDIUM — This introduces a secret-backed, write-capable automation that executes a pinned third-party review action, but the maintainer-controlled trigger, pull_request event, immutable action pin, and disabled cache materially constrain exposure.

VERDICT:
Worth merging: Core workflow and security boundaries are sound. GitHub Actions cannot submit an approving review, so this is posted as a non-blocking comment.

KEY INSIGHT:
The design keeps deeper automated review opt-in while avoiding fork-secret exposure and mutable action code.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/wende/macbeth/actions/runs/30500732836

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Needs improvement

First marked review; no prior marked findings to classify.

New findings

  • The workflow does not implement the documented maintainer-controlled openhands-review label trigger.

[RISK ASSESSMENT]

  • [Overall PR] ⚠️ Risk Assessment: 🟡 MEDIUM — The workflow is secret-backed and write-capable; its actual broad automatic triggers make the control boundary differ from the description.

VERDICT:
Needs rework: Align the event/filter with the documented explicit label trigger before merging.

KEY INSIGHT:
The trigger policy currently runs on ordinary same-repository PR activity rather than label opt-in.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/wende/macbeth/actions/runs/30501227982

Comment thread .github/workflows/openhands-pr-review.yml

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Needs improvement

Previous review follow-up

  • Label-trigger contradictionresolved. The previous finding flagged a contradiction between the documented openhands-review label trigger and the actual broad event list. The PR description has been rewritten to describe the workflow as automatic, and the inline comment in .github/workflows/openhands-pr-review.yml (lines 4-6) now explicitly documents the same-repository-only / no-label design. The contradiction no longer exists.

New findings

  • Missing continue-on-error: true is the main correctness gap (see inline).

[RISK ASSESSMENT]

  • [Overall PR] ⚠️ Risk Assessment: 🟡 MEDIUM — Secret-backed, write-capable, runs on every same-repo push including drafts; a missing advisory-mode flag means transient failures will block PRs (see inline).

VERDICT:
Needs rework: Add continue-on-error: true so this advisory reviewer cannot block PRs on transient API failures.

KEY INSIGHT:
The skill file is sound, the action SHA is well-aged (8 days, past the 7-day rule), but the job must be marked advisory to match the MiniMax workflow's existing convention.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/wende/macbeth/actions/runs/30501380566

Comment thread .github/workflows/openhands-pr-review.yml
@wende
wende dismissed github-actions[bot]’s stale review July 30, 2026 00:16

Superseded: the PR description now documents automatic review as intended, and the later OpenHands follow-up verified the finding as resolved.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous review follow-up

  • Label-trigger contradiction — resolved. Event list and inline comment now consistently describe the same-repository automatic trigger, with no labeled event or label filter.
  • Missing continue-on-error — resolved. The job now carries continue-on-error: true so a model or third-party failure cannot block the PR.
  • Missing labeled event / no label filter — resolved (intentional). Documented inline as same-repository automatic; no maintainer label is required.

New findings

  • 🟠 issues: write is unused.github/workflows/openhands-pr-review.yml:13 grants issues: write, but the action only ever calls POST/DELETE repos/.../pulls/.../reviews, which needs pull-requests: write. The PR description explicitly states it grants only the permissions required to post reviews, so the issues: write line is both unused and inconsistent with that claim. Drop it to keep the job at least privilege.

[RISK ASSESSMENT]

  • [Overall PR] ⚠️ Risk Assessment: 🟢 LOW — Pinning, fork-skip, continue-on-error, and concurrency are sound. The unused issues: write scope widens the blast radius if the token is ever misused, but does not on its own create a new vulnerability.

VERDICT:
🟡 Acceptable — approve once the issues: write line is removed.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/wende/macbeth/actions/runs/30502554784

Comment on lines +12 to +13
pull-requests: write
issues: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Important: issues: write is unused. The action only calls the pull-request reviews API (POST/DELETE repos/.../pulls/.../reviews), which is covered by pull-requests: write. The PR description claims it grants only the permissions required to post reviews, so this line is both unused and inconsistent with that claim — drop it to keep the job at least privilege.

Suggested change
pull-requests: write
issues: write
pull-requests: write

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous review follow-up

  • Label-trigger contradictionresolved. The event list does not include labeled, and the inline comment now consistently describes the same-repository automatic trigger.
  • Missing continue-on-errorresolved. The review job carries continue-on-error: true.
  • Unused issues: write (line 13)still present. Verified against the pinned action at 1f5bd01: the only GitHub writes are gh api -X POST/DELETE repos/.../pulls/.../reviews[/...] (action.yml permission probe) and the same endpoints from agent_script.py; the GraphQL queries in agent_script.py only touch PR review threads, review comments, and the diff files endpoint; the agent is given get_default_tools (no GitHub MCP server) and grep -in 'issue' agent_script.py returns nothing. The PR description still claims the workflow "grants only the permissions required to post reviews", so this line is both unused and contradicts the stated least-privilege guarantee. Same finding as the existing unresolved thread, no new evidence to add.

New findings

None.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/wende/macbeth/actions/runs/30502848579

@wende
wende marked this pull request as ready for review July 30, 2026 01:36
@cursor

cursor Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • If the workflow only needs to comment on PRs, consider dropping issues: write from the permissions block to minimize the token scope.
  • You can use the built-in ${{ github.token }} instead of ${{ secrets.GITHUB_TOKEN }} for the github-token input so the workflow doesn’t depend on an extra secret.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- If the workflow only needs to comment on PRs, consider dropping `issues: write` from the permissions block to minimize the token scope.
- You can use the built-in `${{ github.token }}` instead of `${{ secrets.GITHUB_TOKEN }}` for the `github-token` input so the workflow doesn’t depend on an extra secret.

## Individual Comments

### Comment 1
<location path=".github/workflows/openhands-pr-review.yml" line_range="10-13" />
<code_context>
+  pull_request:
+    types: [opened, reopened, ready_for_review, synchronize]
+
+permissions:
+  contents: read
+  pull-requests: write
+  issues: write
+
+concurrency:
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Consider narrowing workflow permissions to the minimum required (e.g., dropping `issues: write` if not needed).

This workflow requests `contents: read`, `pull-requests: write`, and `issues: write`. If the job never interacts with issues, remove `issues: write` to better enforce least privilege and limit the impact of a compromised action or dependency.

Suggested implementation:

```
permissions:
  contents: read
  pull-requests: write

```

Verify that no jobs or steps in this workflow (or called reusable workflows) create, modify, or comment on issues. If any issue-related operations exist elsewhere in the file, either reintroduce `issues: write` or refactor those steps to use pull request comments or other mechanisms that match the reduced permission set.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +10 to +13
permissions:
contents: read
pull-requests: write
issues: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Consider narrowing workflow permissions to the minimum required (e.g., dropping issues: write if not needed).

This workflow requests contents: read, pull-requests: write, and issues: write. If the job never interacts with issues, remove issues: write to better enforce least privilege and limit the impact of a compromised action or dependency.

Suggested implementation:

permissions:
  contents: read
  pull-requests: write

Verify that no jobs or steps in this workflow (or called reusable workflows) create, modify, or comment on issues. If any issue-related operations exist elsewhere in the file, either reintroduce issues: write or refactor those steps to use pull request comments or other mechanisms that match the reduced permission set.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 MiniMax review — MiniMax-M3

Verdict: ✅ Approve

Adds an AI-assisted PR review skill guide and a GitHub Actions workflow that invokes an LLM-based reviewer on same-repo PRs. The workflow follows security best practices (SHA-pinned action, scoped permissions, explicit fork-PR filter, concurrency cancel, timeout, continue-on-error for advisory behavior) and the skill file is well-targeted guidance for the project's TS/Swift/MCP stack.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous review follow-up

  • Label-trigger contradiction (line 8) — resolved. The event list is now [opened, reopened, ready_for_review, synchronize] with no labeled event or label filter, and the inline comment consistently describes the same-repository automatic trigger.
  • Missing continue-on-error (line 25) — resolved. The job now carries continue-on-error: true, matching the sibling minimax-pr-review.yml convention.
  • Unused issues: write (line 13) — still present. Verified against the pinned action at 1f5bd01be92de79719259e7ff96d01764ce0aa52 (v1.0.0): the only GitHub writes are POST/DELETE repos/.../pulls/.../reviews declared in action.yml, and the bundled OpenHands extensions GitHub surface is read-only (GraphQL for previous review context, GET /pulls/{n}/files). The action does not write issues, labels, or assignees. The PR description still claims the workflow grants only the permissions required to post reviews, so the line is both unused and inconsistent with that claim. The sibling minimax-pr-review.yml:9 confirms pull-requests: write alone is sufficient — drop issues: write to match the stated least-privilege intent.

New findings

None beyond the still-present issues: write line above. The pin to 1f5bd01b... is well-formed (tag 52da8beb points to the same commit, age/publisher within the same first-party organization as the reviewed repo so the 7-day waiting rule is intentionally excluded) and the pinned action's enable-uv-cache default is already 'false', so the loss of the explicit consumer override is intentional rather than a regression.

Risk assessment

  • [Overall PR] 🟡 MEDIUM — unchanged from the previous review. The workflow is secret-backed, write-capable, and runs on every same-repository PR event (including drafts), but the trigger, advisory flag, and pinned action are otherwise sound. The remaining over-privilege is small but real: drop issues: write to bring the manifest in line with the description.

Verdict

Needs rework — one line change (issues: write on line 13) to align the workflow with the PR description's stated least-privilege intent.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/wende/macbeth/actions/runs/30506104311

@wende
wende merged commit 7dce9e6 into main Jul 30, 2026
11 checks passed
@wende
wende deleted the agent/openhands-pr-review branch July 30, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant