Remote PR Review
Overview
Create a clean, throwaway worktree for a PR, then run two independent review passes (codex review and PAL precommit) and merge the feedback into one prioritized set of fixes.
Inputs
pr: PR number or URL (preferred)
repo: optional OWNER/REPO (used when pr is a number and you’re not already in the target repo)
repo-dir: optional local repo path (required for non-openai/openai PRs if you aren’t already in that repo)
extra: optional focus areas (perf, security, API, tests, etc.)
Quick start
- Prepare a
pr-review-<pr-number> worktree and print JSON:
python "<path-to-skill>/scripts/prepare_pr_worktree.py" --pr "<number-or-url>" --json
- If
--pr is just a number and you’re not in the target repo, add --repo "<owner/repo>".
- For non-openai/openai repos, add
--repo-dir "<path-to-local-clone>" when needed.
The JSON includes at least: worktree_dir, repo, pr_number, base_ref, head_ref, pr_url.
Workflow
1) Create / reuse the PR worktree
- Run
prepare_pr_worktree.py.
- If it fails due to a dirty worktree/repo, stop and either clean it up or delete the worktree and retry.
2) Run Codex review (CLI)
cd <worktree_dir>
- Ensure base ref exists locally (pick the right remote for the repo; prefer
upstream if present, else origin):
git fetch <remote> <base_ref>
- Run review and capture the full output as
codex_review:
- Default prompt (if the user didn’t provide one):
codex review --base "<remote>/<base_ref>" "Review for correctness, security, performance, tests, and maintainability. Prioritize issues (blockers vs suggestions vs nits) and reference files/paths when possible."
- If the user provided extra focus areas, append them to the prompt.
3) Run PAL precommit review (tool)
- Call
functions.mcp__pal__precommit against the PR base (not staged/unstaged):
path: <worktree_dir>
compare_to: "<remote>/<base_ref>"
precommit_type: "external"
severity_filter: "all"
Capture the output as pal_review.
4) Merge feedback and present a single review
- Deduplicate overlapping findings; reconcile disagreements (call them out explicitly).
- Prioritize into:
- Blockers (must fix): correctness, security, data loss, breaking API/ABI, missing tests, CI failures.
- High-signal improvements: maintainability, performance, edge cases, observability.
- Nits: style/consistency (only if low-noise).
- Provide a short verification checklist (tests to run, manual steps, roll-out risk).
Cleanup (optional)
- openai/openai (workforest):
wf rm pr-review-<pr-number> -y
- other repos (git worktree):
wt rm "<worktree_dir>" -f (or git -C "<repo-dir>" worktree remove "<worktree_dir>")
1---2name: remote-pr-review3description: Create a dedicated worktree for a GitHub PR (use `wf` for openai/openai workforests, `wt` for all other repos), check out the PR locally, run `codex review` plus a PAL `mcp__pal__precommit` review against the PR base, then merge both into one actionable review summary.4---5
6# Remote PR Review
7
8## Overview
9
10Create a clean, throwaway worktree for a PR, then run two independent review passes (`codex review` and PAL precommit) and merge the feedback into one prioritized set of fixes.
11
12## Inputs
13
14- `pr`: PR number or URL (preferred)
15- `repo`: optional `OWNER/REPO` (used when `pr` is a number and you’re not already in the target repo)
16- `repo-dir`: optional local repo path (required for non-openai/openai PRs if you aren’t already in that repo)
17- `extra`: optional focus areas (perf, security, API, tests, etc.)
18
19## Quick start
20
21- Prepare a `pr-review-<pr-number>` worktree and print JSON:
22 - `python "<path-to-skill>/scripts/prepare_pr_worktree.py" --pr "<number-or-url>" --json`
23 - If `--pr` is just a number and you’re not in the target repo, add `--repo "<owner/repo>"`.
24 - For non-openai/openai repos, add `--repo-dir "<path-to-local-clone>"` when needed.
25
26The JSON includes at least: `worktree_dir`, `repo`, `pr_number`, `base_ref`, `head_ref`, `pr_url`.
27
28## Workflow
29
30### 1) Create / reuse the PR worktree
31
32- Run `prepare_pr_worktree.py`.
33- If it fails due to a dirty worktree/repo, stop and either clean it up or delete the worktree and retry.
34
35### 2) Run Codex review (CLI)
36
37- `cd <worktree_dir>`
38- Ensure base ref exists locally (pick the right remote for the repo; prefer `upstream` if present, else `origin`):
39 - `git fetch <remote> <base_ref>`
40- Run review and capture the full output as `codex_review`:
41 - Default prompt (if the user didn’t provide one):
42 - `codex review --base "<remote>/<base_ref>" "Review for correctness, security, performance, tests, and maintainability. Prioritize issues (blockers vs suggestions vs nits) and reference files/paths when possible."`
43 - If the user provided extra focus areas, append them to the prompt.
44
45### 3) Run PAL precommit review (tool)
46
47- Call `functions.mcp__pal__precommit` against the PR base (not staged/unstaged):
48 - `path`: `<worktree_dir>`
49 - `compare_to`: `"<remote>/<base_ref>"`
50 - `precommit_type`: `"external"`
51 - `severity_filter`: `"all"`
52
53Capture the output as `pal_review`.
54
55### 4) Merge feedback and present a single review
56
57- Deduplicate overlapping findings; reconcile disagreements (call them out explicitly).
58- Prioritize into:
59 - **Blockers (must fix)**: correctness, security, data loss, breaking API/ABI, missing tests, CI failures.
60 - **High-signal improvements**: maintainability, performance, edge cases, observability.
61 - **Nits**: style/consistency (only if low-noise).
62- Provide a short **verification checklist** (tests to run, manual steps, roll-out risk).
63
64## Cleanup (optional)
65
66- openai/openai (workforest): `wf rm pr-review-<pr-number> -y`
67- other repos (git worktree): `wt rm "<worktree_dir>" -f` (or `git -C "<repo-dir>" worktree remove "<worktree_dir>"`)