Skip to content
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e636cdb
feat: Add cloud mode for PR review workflow
openhands-agent Feb 8, 2026
bcd905b
Merge branch 'main' into feat/pr-review-cloud-mode
xingyaoww Feb 8, 2026
b457d09
Apply suggestion from @xingyaoww
xingyaoww Feb 8, 2026
158d428
refactor: Address code review feedback for PR review cloud mode
openhands-agent Feb 8, 2026
03cb497
refactor: prepare review context before calling run_*_mode functions
openhands-agent Feb 8, 2026
713e480
fix: Remove unsupported secrets field from Cloud API request
openhands-agent Feb 8, 2026
10fcb49
refactor: Use OpenHandsCloudWorkspace for cloud mode
openhands-agent Feb 8, 2026
71f7f5a
refactor: Unify SDK and cloud mode with shared agent definition
openhands-agent Feb 9, 2026
6f5c045
Merge main into feat/pr-review-cloud-mode
openhands-agent Feb 9, 2026
c564868
fix: Use Cloud API directly for cloud mode PR review
openhands-agent Feb 10, 2026
52d3984
docs: Clarify that GITHUB_TOKEN is still needed for workflow, but age…
openhands-agent Feb 10, 2026
8efbed0
fix: Cloud mode no longer requires GITHUB_TOKEN
openhands-agent Feb 10, 2026
c5f6d34
fix: Restore initial comment posting in cloud mode
openhands-agent Feb 10, 2026
1a8b62b
docs: Add cloud mode prerequisites about GitHub access
openhands-agent Feb 10, 2026
30d738a
Merge branch 'main' into feat/pr-review-cloud-mode
xingyaoww Feb 10, 2026
86b1243
refactor: Use OpenHandsCloudWorkspace for cloud mode
openhands-agent Feb 10, 2026
4cbb910
revert: Restore Cloud API Direct approach for cloud mode
openhands-agent Feb 10, 2026
0680a97
refactor: Address code review feedback for PR review cloud mode
openhands-agent Feb 10, 2026
73b6c0f
Merge branch 'main' into feat/pr-review-cloud-mode
xingyaoww Feb 10, 2026
eb86be2
refactor: Use OpenHandsCloudWorkspace for cloud mode PR review
openhands-agent Feb 10, 2026
bac9c54
fix: Address PR review feedback for cloud mode
openhands-agent Feb 10, 2026
8937ab9
Merge branch 'main' into feat/pr-review-cloud-mode
xingyaoww Feb 10, 2026
1ff9444
Merge branch 'main' into feat/pr-review-cloud-mode
xingyaoww Feb 10, 2026
e25cc17
fix: PR review cloud mode - exit after starting, make LLM_API_KEY opt…
openhands-agent Feb 10, 2026
5e4dfcb
Merge main into feat/pr-review-cloud-mode and refactor PR review agent
openhands-agent Feb 15, 2026
2e68717
refactor: Move PR review mode implementations to utils folder
openhands-agent Feb 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 46 additions & 8 deletions .github/actions/pr-review/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ branding:
color: blue

inputs:
mode:
description: "Review mode: 'sdk' (run locally) or 'cloud' (run in OpenHands Cloud sandbox)"
required: false
default: sdk
llm-model:
description: LLM model to use for the review
description: LLM model to use for the review (used in both modes)
required: false
default: anthropic/claude-sonnet-4-5-20250929
llm-base-url:
Expand All @@ -30,11 +34,20 @@ inputs:
required: false
default: main
llm-api-key:
description: LLM API key (required)
required: true
description: LLM API key (required for both modes)
required: false
default: ''
github-token:
description: GitHub token for API access (required)
description: GitHub token for API access (required for both modes - passed to cloud sandbox in cloud mode)
required: true
openhands-cloud-api-key:
description: OpenHands Cloud API key (required for 'cloud' mode), get it from https://app.all-hands.dev/settings/api-keys
required: false
default: ''
openhands-cloud-api-url:
description: OpenHands Cloud API URL
required: false
default: https://app.all-hands.dev
lmnr-api-key:
description: Laminar API key for observability (optional)
required: false
Expand Down Expand Up @@ -78,20 +91,39 @@ runs:
- name: Install OpenHands dependencies
shell: bash
run: |
uv pip install --system ./software-agent-sdk/openhands-sdk ./software-agent-sdk/openhands-tools lmnr
uv pip install --system ./software-agent-sdk/openhands-sdk ./software-agent-sdk/openhands-tools ./software-agent-sdk/openhands-workspace lmnr

- name: Check required configuration
shell: bash
env:
MODE: ${{ inputs.mode }}
LLM_API_KEY: ${{ inputs.llm-api-key }}
GITHUB_TOKEN: ${{ inputs.github-token }}
OPENHANDS_CLOUD_API_KEY: ${{ inputs.openhands-cloud-api-key }}
run: |
echo "Mode: $MODE"

# GITHUB_TOKEN is required for both modes
if [ -z "$GITHUB_TOKEN" ]; then
echo "Error: github-token is required for both modes."
exit 1
fi

# LLM_API_KEY is required for both modes
if [ -z "$LLM_API_KEY" ]; then
echo "Error: llm-api-key is required."
echo "Error: llm-api-key is required for both modes."
exit 1
fi
if [ -z "$GITHUB_TOKEN" ]; then
echo "Error: github-token is required."

if [ "$MODE" = "sdk" ]; then
: # SDK mode only needs the base requirements
elif [ "$MODE" = "cloud" ]; then
if [ -z "$OPENHANDS_CLOUD_API_KEY" ]; then
echo "Error: openhands-cloud-api-key is required for 'cloud' mode."
exit 1
fi
else
echo "Error: mode must be 'sdk' or 'cloud', got '$MODE'."
exit 1
fi

Expand All @@ -103,15 +135,21 @@ runs:
if [ -n "${{ inputs.llm-base-url }}" ]; then
echo "LLM base URL: ${{ inputs.llm-base-url }}"
fi
if [ "$MODE" = "cloud" ]; then
echo "OpenHands Cloud API URL: ${{ inputs.openhands-cloud-api-url }}"
fi

- name: Run PR review
shell: bash
env:
MODE: ${{ inputs.mode }}
LLM_MODEL: ${{ inputs.llm-model }}
LLM_BASE_URL: ${{ inputs.llm-base-url }}
REVIEW_STYLE: ${{ inputs.review-style }}
LLM_API_KEY: ${{ inputs.llm-api-key }}
GITHUB_TOKEN: ${{ inputs.github-token }}
OPENHANDS_CLOUD_API_KEY: ${{ inputs.openhands-cloud-api-key }}
OPENHANDS_CLOUD_API_URL: ${{ inputs.openhands-cloud-api-url }}
LMNR_PROJECT_API_KEY: ${{ inputs.lmnr-api-key }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
Expand Down
63 changes: 56 additions & 7 deletions examples/03_github_workflows/02_pr_review/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ This example demonstrates how to set up a GitHub Actions workflow for automated

## Features

- **Two Review Modes**:
- **SDK Mode** (default): Runs the agent locally in GitHub Actions
- **Cloud Mode**: Launches the review in OpenHands Cloud for faster CI completion
- **Automatic Trigger**: Reviews are triggered when:
- The `review-this` label is added to a PR, OR
- openhands-agent is requested as a reviewer
Expand Down Expand Up @@ -48,21 +51,31 @@ cp examples/03_github_workflows/02_pr_review/workflow.yml .github/workflows/pr-r

### 2. Configure secrets

Set the following secrets in your GitHub repository settings:
Set the following secrets in your GitHub repository settings based on your chosen mode:

**For SDK Mode (default):**
- **`LLM_API_KEY`** (required): Your LLM API key
- Get one from the [OpenHands LLM Provider](https://docs.all-hands.dev/openhands/usage/llms/openhands-llms)

**Note**: The workflow automatically uses the `GITHUB_TOKEN` secret that's available in all GitHub Actions workflows.
**For Cloud Mode:**
- **`LLM_API_KEY`** (required): Your LLM API key (sent to the cloud sandbox)
- **`OPENHANDS_CLOUD_API_KEY`** (required): Your OpenHands Cloud API key
- Get one from your [OpenHands Cloud account settings](https://app.all-hands.dev/settings/api-keys)

**Note**: The workflow automatically uses the `GITHUB_TOKEN` secret that's available in all GitHub Actions workflows. In cloud mode, this token is passed to the cloud sandbox so the agent can post review comments.

### 3. Customize the workflow (optional)

Edit `.github/workflows/pr-review-by-openhands.yml` to customize the inputs:
Edit `.github/workflows/pr-review-by-openhands.yml` to customize the inputs.

**SDK Mode Configuration (default):**

```yaml
- name: Run PR Review
uses: ./.github/actions/pr-review
with:
# Review mode: 'sdk' runs the agent locally in GitHub Actions
mode: sdk
# LLM configuration
llm-model: anthropic/claude-sonnet-4-5-20250929
llm-base-url: ''
Expand All @@ -77,6 +90,39 @@ Edit `.github/workflows/pr-review-by-openhands.yml` to customize the inputs:
github-token: ${{ secrets.GITHUB_TOKEN }}
```

**Cloud Mode Configuration:**

```yaml
- name: Run PR Review
uses: ./.github/actions/pr-review
with:
# Review mode: 'cloud' runs in OpenHands Cloud sandbox
mode: cloud
# LLM configuration (sent to cloud sandbox)
llm-model: anthropic/claude-sonnet-4-5-20250929
# Review style: roasted (other option: standard)
review-style: roasted
# SDK git ref to use
sdk-version: main
# Secrets for cloud mode
llm-api-key: ${{ secrets.LLM_API_KEY }}
openhands-cloud-api-key: ${{ secrets.OPENHANDS_CLOUD_API_KEY }}
# Optional: custom cloud API URL
# openhands-cloud-api-url: https://app.all-hands.dev
# GitHub token - passed to cloud sandbox for posting review comments
github-token: ${{ secrets.GITHUB_TOKEN }}
```

**Cloud Mode Benefits:**
- Runs in a fully managed cloud sandbox environment
- No local Docker or infrastructure needed
- Same capabilities as SDK mode but in the cloud

**Cloud Mode Architecture:**
- Uses [OpenHandsCloudWorkspace](https://docs.openhands.dev/sdk/guides/agent-server/cloud-workspace) to provision a sandbox
- LLM configuration and GITHUB_TOKEN are sent to the cloud sandbox
- The agent runs in the cloud and posts review comments directly

### 4. Create the review label

Create a `review-this` label in your repository:
Expand Down Expand Up @@ -178,13 +224,16 @@ This workflow uses a reusable composite action located at `.github/actions/pr-re

| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `llm-model` | LLM model to use | No | `anthropic/claude-sonnet-4-5-20250929` |
| `llm-base-url` | LLM base URL (optional) | No | `''` |
| `mode` | Review mode: 'sdk' or 'cloud' | No | `sdk` |
| `llm-model` | LLM model (used in both modes) | No | `anthropic/claude-sonnet-4-5-20250929` |
| `llm-base-url` | LLM base URL (optional, for custom LLM endpoints) | No | `''` |
| `review-style` | Review style: 'standard' or 'roasted' | No | `roasted` |
| `sdk-version` | Git ref for SDK (tag, branch, or commit SHA) | No | `main` |
| `sdk-repo` | SDK repository (owner/repo) | No | `OpenHands/software-agent-sdk` |
| `llm-api-key` | LLM API key | Yes | - |
| `github-token` | GitHub token for API access | Yes | - |
| `llm-api-key` | LLM API key (required for both modes) | Yes | - |
| `github-token` | GitHub token for API access (required for both modes) | Yes | - |
| `openhands-cloud-api-key` | OpenHands Cloud API key (required for cloud mode) | No | - |
| `openhands-cloud-api-url` | OpenHands Cloud API URL | No | `https://app.all-hands.dev` |
| `lmnr-api-key` | Laminar API key for observability (optional) | No | - |

## Review Evaluation (Observability)
Expand Down
Loading
Loading