pr-review
Install and operate an automated pull-request review gate using repository standards and a confined review worker.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- pr-review
- license
- Apache-2.0
- metadata
- { "version": "1.0.2", "corsia-data": "corsia.yaml", "corsia-format": "1" }
- description
- Install and operate an automated pull-request review gate using repository standards and a confined review worker.
02 资源文件 18
- 参考文档CHANGELOG.md641 B
- 参考文档corsia.yaml871 B
- 参考文档measures.yaml7.6 KB
- 参考文档references/review-standards.md1.9 KB
- 参考文档rule-set.json7.0 KB
- 脚本scripts/review_gate_config.py4.1 KB
- 脚本scripts/review_gate_evaluate.py29.1 KB
- 脚本scripts/review_gate_github.py2.2 KB
- 脚本scripts/review_gate_publish.py71.3 KB
- 脚本scripts/review_gate_stage.py9.1 KB
- 脚本scripts/tests/test_generic_config.py3.4 KB
- 脚本scripts/tests/test_measures_yaml.py2.1 KB
- 脚本scripts/tests/test_review_gate_evaluate.py30.4 KB
- 脚本scripts/tests/test_review_gate_head_worktree.py4.2 KB
- 脚本scripts/tests/test_review_gate_live_client.py41.6 KB
- 脚本scripts/tests/test_review_gate_publish.py23.8 KB
- 脚本scripts/tests/test_review_gate_rule_runs.py32.1 KB
- 脚本scripts/tests/test_review_gate_timed.py1.1 KB
03 SKILL.md 正文
Pull-request review gate
The gate evaluates each pull-request head, stages its diff, conversation and standards, starts the pr-reviewer worker, and publishes its verdict. The scripts share a state folder under the owning thread.
Requires
- CORSIA tools:
automation_schedule,event_rules,measure_syncandmeasure_status, and thestart_workerevent-rule action. - The
pr-reviewerskill from this library, installed beside this one: thereviewstep incorsia.yamland the start rules run it. - CORSIA's built-in
github-pr-screenworkflow (screen_workflowinrule-set.json). - A GitHub account connected to CORSIA.
- A POSIX host (the scripts lock state with
fcntl), Python 3.11 or later, andgit.
Reach
- Subprocesses:
git, andcorsia github api, which calls the GitHub API as the connected account. - Network: the GitHub API, and
git fetch origin <sha>from the reviewed repository's remote when the checkout lacks a head. - Paths outside the thread folder: each
repo_checkoutscheckout, where stage runsgit worktree pruneandgit worktree add(a detached worktree per review, inside the thread's staging folder), andstandards_local_rootif set. - Writes in shadow mode: local state, staged inputs and shadow records under the thread folder only. Nothing is written to GitHub.
- Writes in live mode, on each configured repository: commit statuses on the head; pull-request review comments and replies; resolving and unresolving the gate's own review threads; one summary comment per pull request, posted once and then edited in place.
Set up
- Install this skill and
pr-reviewerinto the owning agent's thread, and connect GitHub with an account allowed to write commit statuses and pull-request comments. The owning agent must be in a project that tracks each reviewed repository: register that repository's local checkout withproject_repo_register. A rule that names a repository the project doesn't track is refused. - Commit
references/review-standards.mdto the reviewed repository at the path listed inrule-set.jsonunderstandards; edit it to suit that repository. - Set
repos,repo_checkouts,agents_login, optionalsme, standards paths, status contexts and other settings inrule-set.json. Leavemodeasshadow. Setextended_window_baseonly if you configure the corresponding worker profile. - Register each of the evaluate, stage and publish scripts with
automation_schedule: kindscript, no cadence, authenticated, timeout 300 seconds. Name exactly what each writes in its purpose: evaluate writes local state and emits events; stage writes local state, staged inputs and a detached worktree, and emits events; publish writes local state and shadow records, or in live mode commit statuses, pull-request comments and replies, review-thread resolution, and its own summary comment, and emits events. - Run
measure_syncfor both skills'measures.yamlfiles and confirm the result withmeasure_status. This declares theqaevents that some rules in step 6 match, so it comes first. - Resolve the event rules with
review_gate_config.configured_rules(review_gate_config.load()), then create each withevent_rules create, substituting$reposand the registered script IDs. For an extended-window base, configure the named worker profile. The start rule usesstart_workerwith the worker skill andrequest_identityfact. - Run in shadow mode on a few pull requests and show the person the results. Switching to live mode posts on their repository: ask them, and switch only on their explicit yes. Then re-register the scripts and rules.
- If a head has no verdict, first check the current head and existing events to avoid a duplicate review. Under
review_gate_evaluate.StateStore.transaction(), clear that PR'sin_flightclaim; if it was marked reviewed without a published verdict, also clearreviewedandmergeability. Preserve the number of attempts already used asattempts={"head": <head>, "n": <used>}usingput. Re-firing a completed check run for that head is an action on the person's repository: ask them first. Once it re-fires, evaluate requests the next attempt. Verify the verdict on that exact head; do not reset the attempt to zero, which reuses an already-consumed request identity.
Registered scripts are hash-pinned: changing a file in their folder stops the registered runs. Install changes into a second script folder, register all three there, create the replacement rules, wait for queued old runs to start, disable the old rules, then cancel the old schedules. Tests belong in a separate copy while registered scripts are active.
04 同仓库更多 Skills
example
Edited fixture description without a version increment.
example
Original fixture description.
linked
Fixture with a symlinked support file.
scripted
Fixture with a script in its scripts folder.
scripted
Fixture with code in a nested scripts folder.
scripted
Fixture with code outside a scripts folder.