Repository navigation
feat(skills): review GitHub PRs from pinned snapshots - #2038
lizhengfeng101 wants to merge 4 commits into
Conversation
|
🔍 OpenCodeReview found 4 issue(s) in this PR.
|
| - name: Test installed PR review helpers | ||
| run: python3 scripts/github-actions/test_review_pr.py |
There was a problem hiding this comment.
Fragile runtime dependency: This job runs inside a node:24.22.1 container, which only includes Python 3 incidentally (via the Debian base image). This is not a guaranteed part of the Node.js image contract — a future image update or switch to a slimmer variant could remove Python and break this step.
Consider either:
- Running this step in a separate job with a
python:3.xcontainer, or - Adding an explicit
apt-get install -y python3step before this, or - Using
actions/setup-python(though this may not work inside a container job).
This makes the dependency intentional and resilient to base image changes.
| command("git", "clone", "--bare", "--shared", "--single-branch", "--no-tags", "--template=", | ||
| "--", source, store, cwd=folder, env=dict(offline, GIT_ALLOW_PROTOCOL="file")) |
There was a problem hiding this comment.
Using --shared creates a bare clone whose object store references the source repository's objects via alternates. If the source repository undergoes garbage collection (git gc, git prune) while the review is in progress, objects needed for merge-base, rev-parse, or worktree operations can disappear, causing mid-review failures.
Consider using --dissociate alongside --shared to copy the necessary objects locally and sever the alternates link, or drop --shared entirely and accept the cost of a full local copy. This would make the review isolated from concurrent operations on the source repo.
| if result.is_file(): | ||
| summary["result"] = str(result) | ||
| try: | ||
| release(folder, summary.get("snapshot", {}).get("head"), offline) |
There was a problem hiding this comment.
When lookup fails before setting snapshot in summary, this call passes head=None to release. While the current control flow makes it unlikely for the worktree to exist in that case, release compares git rev-parse HEAD output (a string) against None on line 96, which always evaluates as unequal and raises a misleading "worktree changed; retained" error. Adding an early guard would make the function robust against future refactoring:
def release(folder, head, env):
store, tree = folder / "objects.git", folder / "worktree"
if tree.exists():
if head is None:
raise ValueError("cannot verify worktree integrity: head revision unknown")
...| def command(*args, cwd=None, env=None): | ||
| result = subprocess.run(args, cwd=cwd, env=env, text=True, stdout=subprocess.PIPE) | ||
| if result.returncode: | ||
| raise ValueError(f"{args[0]} {args[1]} exited {result.returncode} (see stderr)") |
There was a problem hiding this comment.
The error message says "(see stderr)" but stderr is not captured or included in the exception. Since subprocess.run here only captures stdout=subprocess.PIPE, stderr goes directly to the parent process's stderr stream and is not available in the exception. When this exception is caught and serialized into the manifest JSON (line 160), the user only sees the exit code with no diagnostic detail.
Consider capturing stderr and including it in the error message, e.g.:
result = subprocess.run(args, cwd=cwd, env=env, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if result.returncode:
raise ValueError(f"{args[0]} {args[1]} exited {result.returncode}: {result.stderr.strip()}")
Description
The native
open-code-reviewskill can review a GitHub PR by number:42selects PR 42 in the GitHub CLI's default repository for the checkout, including an upstream default when working in a fork. The report identifies the resolved PR.pr 42, a full PR URL, and42 --repo OWNER/REPOalso work. This is a skill entry point, not a newocrCLI flag. Local workspace, commit, and branch reviews keep their existing workflow.Both installation layouts ship the same helper. It verifies GitHub's advertised commits, reviews the merge-base-to-head range once in a private detached worktree, and releases clean temporary resources without changing the caller's checkout. Before returning, it reports whether the snapshot is current, stale, or unverifiable. The native OCR result and run manifest remain available after cleanup.
Before merge
Validation
make check,make test, the installed-helper contract suite, and the plugin manifest and link checks.AI Disclosure
OpenAI Codex (
gpt-6.2-astra) assisted with implementation, tests, and PR preparation. The pre-commit review used Open Code Review (configured model:claude-opus-4-6).Refs #2025 and #2023.