





























@@ -1,16 +1,16 @@
11---
22name: autoreview
3-description: "Autoreview closeout: local dirty changes, PR branch vs main, parallel tests."
3+description: "Auto Review closeout. Codex review is the default when no engine is set and is the recommended reviewer."
44---
556-# Autoreview
6+# Auto Review
778-Run Codex's built-in code review as a closeout check. This is code review (`codex review`), not Guardian `auto_review` approval routing.
8+Run the bundled structured review helper as a closeout check. This is code review, not Guardian `auto_review` approval routing.
9910-Codex native review mode performs best and is recommended. Non-Codex reviewers are fallback/second-opinion paths that receive a generated diff prompt, not the full Codex review-mode runtime.
10+Codex review is the default when no engine is set. It usually delivers the best review results and should remain the normal final closeout engine.
11111212Use when:
13-- user asks for Codex review / autoreview / second-model review
13+- user asks for Codex review / Claude review / autoreview / second-model review
1414- after non-trivial code edits, before final/commit/ship
1515- reviewing a local branch or PR branch after fixes
1616@@ -21,60 +21,63 @@ Use when:
2121- Read dependency docs/source/types when the finding depends on external behavior.
2222- Reject unrealistic edge cases, speculative risks, broad rewrites, and fixes that over-complicate the codebase.
2323- Prefer small fixes at the right ownership boundary; no refactor unless it clearly improves the bug class.
24-- Keep going until the selected review path returns no accepted/actionable findings.
25-- If a review-triggered fix changes code, rerun focused tests and rerun the review helper.
26-- Default to Codex review with no fallback. Prefer Codex for final closeout because it uses native review mode; non-Codex reviewers use a Codex-inspired generated diff prompt. Use `--fallback-reviewer auto|claude|pi|opencode|droid|copilot` only when a second-model fallback is explicitly wanted and authenticated. The helper runs nested Codex review in yolo/full-access mode by default; use `--no-yolo` only when intentionally testing sandbox behavior.
27-- Stop as soon as the review command/helper exits 0 with no accepted/actionable findings. Do not run an extra direct `codex review` just to get a nicer "clean" line, a second opinion, or clearer closeout wording.
24+- Keep going until structured review returns no accepted/actionable findings.
25+- If a review-triggered fix changes code, rerun focused tests and rerun the structured review helper.
26+- For security-audit suppression changes, verify accepted findings remain auditable: suppressed findings stay in structured output, active output keeps an unsuppressible suppression notice, and aggregate findings cannot hide unrelated active risk.
27+- Never switch or override the requested review engine/model. If the review hits model capacity, retry the same command a few times with the same engine/model.
28+- Tools are useful in review mode. The helper allows read-only inspection tools and web search by default so reviewers can check dependency contracts, upstream docs, and current behavior.
29+- Security perspective is always included, but it should not cripple legitimate functionality. Report security findings only when the change creates a concrete, actionable risk or removes an important safety check.
30+- Do not invoke built-in `codex review`, nested reviewers, or reviewer panels from inside the review. The helper builds one bundle, calls one selected engine, validates one structured result, and stops.
31+- Stop as soon as the helper exits 0 with no accepted/actionable findings. Do not run an extra review just to get a nicer "clean" line, a second opinion, or clearer closeout wording.
2832- Treat the helper's successful exit plus absence of actionable findings as the clean review result, even if the underlying Codex CLI output is terse.
2933- If rejecting a finding as intentional/not worth fixing, add a brief inline code comment only when it explains a real invariant or ownership decision that future reviewers should know.
30-- If creating or updating a PR while rejecting any autoreview finding, record the rejected finding and reason in the PR description so later reviewers can distinguish intentional design decisions from missed review output.
34+- If `gh`/Gitcrawl reports `database disk image is malformed`, run `gitcrawl doctor --json` once to let the portable cache repair before retrying review; do not bypass the shim unless repair fails and freshness requires live GitHub.
35+- If Gitcrawl reports a portable manifest mismatch, source/runtime DB health error, or stale portable-store checkout, run `gitcrawl doctor --json` and inspect `source_db_health`, `runtime_db_health`, and `portable_store_status` before falling back to live GitHub.
3136- Do not push just to review. Push only when the user requested push/ship/PR update.
32-- For OpenClaw maintainers, keep autoreview validation Crabbox/Testbox-aware when maintainer validation mode is enabled (`OPENCLAW_TESTBOX=1` or `AUTOREVIEW_OPENCLAW_MAINTAINER_VALIDATION=1`). A review pass may inspect files and run cheap non-Node probes, but it must not start local `pnpm`, Vitest, `tsgo`, `npm test`, or `node scripts/run-vitest.mjs` from a Codex/worktree review unless the operator explicitly requested local proof. For runtime proof, use existing evidence or route through Crabbox/Testbox and report the id. Do not apply this rule to ordinary contributors who do not have maintainer Testbox access.
33373438## Pick Target
35393640Dirty local work:
37413842```bash
39-codex review --uncommitted
43+<autoreview-helper> --mode local
4044```
41454246Use this only when the patch is actually unstaged/staged/untracked in the
43-current checkout. For committed, pushed, or PR work, point Codex at the commit
47+current checkout. For committed, pushed, or PR work, point the helper at the commit
4448or branch diff instead; do not force `--mode local` / `--uncommitted` just
45-because the helper docs mention dirty work first. A clean `--uncommitted` review
49+because the helper docs mention dirty work first. A clean local review
4650only proves there is no local patch.
47514852Branch/PR work:
49535054```bash
51-git fetch origin
52-codex review --base origin/main
55+<autoreview-helper> --mode branch --base origin/main
5356```
545755-Do not pass any prompt with `--base`, `--commit`, or `--uncommitted`. Codex CLI
56-review targets and custom review prompts are mutually exclusive: target modes
57-generate their own review prompt internally. Use plain target review for native
58-Codex closeout, or use custom prompt review (`codex review -`) only when you
59-intentionally want a generated diff prompt instead of native target review.
58+Optional review context is first-class:
59+60+```bash
61+<autoreview-helper> --mode branch --base origin/main --prompt-file /tmp/review-notes.md --dataset /tmp/evidence.json
62+```
60636164If an open PR exists, use its actual base:
62656366```bash
6467base=$(gh pr view --json baseRefName --jq .baseRefName)
65-codex review --base "origin/$base"
68+<autoreview-helper> --mode branch --base "origin/$base"
6669```
67706871Committed single change:
69727073```bash
71-codex review --commit HEAD
74+<autoreview-helper> --mode commit --commit HEAD
7275```
73767477or with the helper:
75787679```bash
77-.agents/skills/autoreview/scripts/autoreview --mode commit --commit HEAD
80+/Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode commit --commit HEAD
7881```
79828083Use commit review for already-landed or already-pushed work on `main`. Reviewing
@@ -87,46 +90,53 @@ with `--base`.
8790Format first if formatting can change line locations. Then it is OK to run tests and review in parallel:
88918992```bash
90-.agents/skills/autoreview/scripts/autoreview --parallel-tests "<focused test command>"
93+scripts/autoreview --parallel-tests "<focused test command>"
9194```
92959396Tradeoff: tests may force code changes that stale the review. If tests or review lead to code edits, rerun the affected tests and rerun review until no accepted/actionable findings remain. Once that rerun exits cleanly, stop; do not spend another long review cycle on redundant confirmation.
94979598## Context Efficiency
969997-Codex review is usually noisy. Default to a subagent filter when subagents are available. Ask it to run the review and return only:
98-- actionable findings it accepts
99-- findings it rejects, with one-line reason
100-- exact files/tests to rerun
101-102-Run inline only for tiny changes or when subagents are unavailable.
100+Run the helper directly so target selection, engine choice, structured validation, and exit status all stay in one path. If output is noisy, summarize the completed helper output after it returns; do not ask another agent or reviewer to rerun the review.
103101104102## Helper
105103106-Bundled helper:
104+OpenClaw repo-local helper:
107105108106```bash
109107.agents/skills/autoreview/scripts/autoreview --help
110108```
111109110+`agent-scripts` checkout helper:
111+112+```bash
113+skills/autoreview/scripts/autoreview --help
114+```
115+116+Global helper from `agent-scripts`:
117+118+```bash
119+~/.codex/skills/agent-scripts/autoreview/scripts/autoreview --help
120+```
121+122+If installed from `agent-scripts`, path is:
123+124+```bash
125+/Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --help
126+```
127+112128The helper:
113-- chooses dirty `--uncommitted` first
129+- chooses dirty local changes first
114130- otherwise uses current PR base if `gh pr view` works
115131- otherwise uses `origin/main` for non-main branches
116-- auto-runs `PNPM_CONFIG_PM_ON_FAIL=ignore PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false PNPM_CONFIG_OFFLINE=true pnpm run check` in parallel when a repo has `package.json`, `pnpm-lock.yaml`, `node_modules`, and a `check` script; disable with `AUTOREVIEW_AUTO_TESTS=0`
132+- supports `--engine codex` and `--engine claude`; default is `AUTOREVIEW_ENGINE` or `codex`; Codex should remain the default when nothing is set
117133- use `--mode commit --commit <ref>` for already-committed work, especially clean `main` after landing
118134- should be left in `--mode auto` or forced to `--mode branch` for PR/branch work; do not force `--mode local` after committing
119-- supports `--reviewer codex|claude|pi|opencode|droid|copilot|auto`; `auto` means Codex first
120-- supports `--fallback-reviewer auto|claude|pi|opencode|droid|copilot|none`; default is `none`
121-- falls back only when Codex is unavailable or exits nonzero, not when Codex reports findings
122-- writes only to stdout unless `--output` or `AUTOREVIEW_OUTPUT` is set
123-- supports `--dry-run`, `--parallel-tests`, and commit refs
124-- runs nested review with `--dangerously-bypass-approvals-and-sandbox --sandbox danger-full-access` by default
125-- with `OPENCLAW_TESTBOX=1` or `AUTOREVIEW_OPENCLAW_MAINTAINER_VALIDATION=1`, disables auto local `pnpm run check` and routes Codex through generated prompt review (`codex review -`) so the no-local-heavy-tests policy is included; native Codex target review cannot accept extra prompt text
126-- non-Codex reviewers receive the generated diff prompt and maintainer validation policy text when maintainer validation is active
127-- keeps accepting `--full-access`; use `--no-yolo` or `AUTOREVIEW_YOLO=0` to opt out
128-- still accepts legacy `CODEX_REVIEW_*` env vars when the matching `AUTOREVIEW_*` var is unset
135+- writes only to stdout unless `--output` or `--json-output` is set
136+- supports `--dry-run`, `--parallel-tests`, `--prompt`, `--prompt-file`, `--dataset`, `--no-tools`, `--no-web-search`, and commit refs
137+- allows read-only tools and web search by default; forbids nested review in the prompt; Codex is run through `codex exec` with read-only sandbox and structured output
129138- prints `autoreview clean: no accepted/actionable findings reported` when the selected review command exits 0
139+- exits nonzero when accepted/actionable findings are present
130140131141## Final Report
132142@@ -136,11 +146,4 @@ Include:
136146- findings accepted/rejected, briefly why
137147- the clean review result from the final helper/review run, or why a remaining finding was consciously rejected
138148139-Do not run another Codex review solely to improve the final report wording. If the final helper run exited 0 and produced no accepted/actionable findings, report that exact run as clean.
140-141-## PR / CI Closeout
142-143-- Prefer direct run/job APIs after CI starts: `gh run view <run-id> --json jobs`; use PR rollup only for final mergeability.
144-- After rebase, compare `origin/main..HEAD`; drop CI-fix commits already upstream before pushing.
145-- For prompt snapshot CI failures, prove/generate with Linux Node 24 before rerunning the failed job.
146-- Update PR body once near the final head unless proof labels are missing or stale enough to block CI.
149+Do not run another review solely to improve the final report wording. If the final helper run exited 0 and produced no accepted/actionable findings, report that exact run as clean.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。