Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions plugins/pr-review/scripts/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@

For dependency update PRs, do **NOT** approve a target version that was published less than 7 days ago. First-party packages maintained by the same organization as the reviewed repository are intentionally excluded from this 7-day waiting rule, but still scrutinize them for supply-chain risk.

Before reviewing, you MUST read the repository's own guidance to understand the repo first: read `AGENTS.md` at the repository root (and any nested `AGENTS.md` covering the changed files), plus other relevant docs when present — e.g. `CONTRIBUTING.md`, `CLAUDE.md`, `.cursorrules`, and any review or coding-guideline docs. Apply that guidance to your review.

Review the PR changes below and identify issues that need to be addressed.

## Pull Request Information
Expand Down
10 changes: 6 additions & 4 deletions skills/github-pr-reviewer/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,14 @@ def _build_review_prompt(pr: dict, head_sha: str, label_event: dict) -> str:
f" Example: `git clone {clone_url} pr-review-{number}`.\n"
"2. Check out the exact pull request branch by PR number, then verify HEAD matches the SHA above.\n"
f" Example: `git fetch origin pull/{number}/head:openhands-pr-{number}` followed by `git checkout openhands-pr-{number}`.\n"
"3. Inspect the existing PR context before reviewing, including PR description, issue comments, review comments, changed files, and the diff.\n"
"3. Before reviewing, you MUST read the repository's own guidance to understand the repo first.\n"
" Read `AGENTS.md` at the cloned repository root (and any nested `AGENTS.md` covering the changed files), plus other relevant docs when present — e.g. `CONTRIBUTING.md`, `CLAUDE.md`, `.cursorrules`, and any review or coding-guideline docs. Apply that guidance to your review.\n"
"4. Inspect the existing PR context before reviewing, including PR description, issue comments, review comments, changed files, and the diff.\n"
" Prefer `gh pr view`, `gh pr diff`, `gh pr checkout`, or GitHub REST API calls with `GITHUB_PERSONAL_ACCESS_TOKEN`; do not print secret values.\n"
"4. Use the checked-out repository to inspect relevant files and surrounding code, not just the patch.\n"
"5. Before producing the final review text, delete only the cloned repository directory created in step 1.\n"
"5. Use the checked-out repository to inspect relevant files and surrounding code, not just the patch.\n"
"6. Before producing the final review text, delete only the cloned repository directory created in step 1.\n"
f" Example: `rm -rf pr-review-{number}`. Do not delete any other files or directories.\n"
"6. Write a high-signal review comment with specific findings. If there are no material issues, say so.\n"
"7. Write a high-signal review comment with specific findings. If there are no material issues, say so.\n"
f"\nReview instructions:\n{tone}{extra}\n\n"
"Output ONLY the review text — no preamble, no meta-commentary. "
"This text will be posted verbatim as a comment on the pull request. "
Expand Down
10 changes: 10 additions & 0 deletions tests/test_pr_review_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ def test_prompt_with_roasted_trigger():
assert "/codereview-roasted" in prompt


def test_prompt_instructs_reading_repo_guidance():
"""The reviewer must be told to read AGENTS.md (and other guideline docs)
to understand the repo before reviewing."""
prompt = _format_prompt(require_evidence=False)

assert "AGENTS.md" in prompt
assert "MUST read" in prompt
assert "CONTRIBUTING.md" in prompt


def test_format_prompt_omits_evidence_requirements_by_default():
prompt = _format_prompt(require_evidence=False)

Expand Down
Loading