review-pipeline
Multi-stage iterative review pipeline across all active worktree branches
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Multi-stage iterative review pipeline across all active worktree branches
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Post-merge integration gate — cleanup, build, test, verify issues, update memory
Multi-stage iterative review pipeline across all active worktree branches
Post-merge integration gate — cleanup, build, test, verify issues, update memory
| name | review-pipeline |
| description | Multi-stage iterative review pipeline across all active worktree branches |
| user-invokable | true |
Run an iterative review pipeline on active worktree branches. Repeats until zero P1s remain or the iteration limit is reached.
This is the ONLY review mechanism. Do not substitute with ad-hoc
self-review agents, custom subagents, or any improvised review approach.
The standalone /self-review and /codex-review skills have been merged
into this single pipeline. When the user says "review", "run reviews",
or any variation, invoke THIS skill.
.Codex/worktrees/*/ branches diverged from mainreview-pipeline fix/my-branch)--skip-codex: skip the Codex external review stageTrack the current iteration number and report it in each consolidation (e.g., "Round 2 of 4").
Identify worktrees to review:
git worktree list
For each worktree under .Codex/worktrees/, check if the branch has diverged
from main (git log main..HEAD --oneline). Skip worktrees with no new commits.
If $ARGUMENTS specifies a branch name, filter to just that one.
For each discovered branch, collect changed files:
cd {worktree_path} && git diff --name-only main...HEAD
Build a file overlap matrix and suggest merge order:
Launch all review tasks in a single message (background mode) so they run concurrently. N worktrees produce up to 2N parallel tasks (N Claude subagents + N Codex commands).
Launch one Agent(subagent_type="general-purpose", run_in_background=true)
per worktree with this prompt:
You are auditing the branch
{branch}at{worktree_path}.
- Run
git diff main...HEADto see all changes- Read each changed file in full
- Audit for:
- Logic bugs, panics (
unwrap,expect, array indexing)- Missing input validation
- Numerical stability (division by zero, NaN propagation, overflow)
- Physics correctness (for nereids-physics/nereids-endf)
- API consistency with existing patterns
- Edge cases (empty inputs, zero counts, exactly-determined systems)
- Report findings as:
- P1 (must fix) — correctness bugs, panics, data corruption
- P2 (should fix) — robustness, style, minor improvements
- Include
file:linereferences for each finding- Run
cargo test --workspace --exclude nereids-pythonto verify tests pass (workspace-wide, because changes often ripple across crates)
Status (April 2026): Codex review is currently driven manually by the
user outside this pipeline. Skip the automated codex exec step until the
local codex-cli access issue is resolved (the installed binary is too old
for the current API and ChatGPT-account model gating prevents falling back
to an older model — see "Known pitfalls" below). When the user's local
codex-cli is upgraded and accepted by the API, re-enable by removing this
notice and uncommenting the launch step.
When re-enabled, also launch one Bash command per worktree in the same
message as the Claude self-audit, unless --skip-codex is in
$ARGUMENTS.
There is no codex review subcommand in current codex-cli (verified
against 0.46 and 0.125, April 2026). The slash command /review exists
but is interactive-only — it cannot be driven from codex exec. The
canonical headless invocation is codex exec with an explicit review
prompt; a native codex exec review is requested in
openai/codex#6432 but
not yet shipped.
Use this pattern (one Bash call per worktree):
codex exec --sandbox read-only --skip-git-repo-check \
-C {worktree_path} \
--output-last-message /tmp/codex-review-{branch_slug}.md \
"$(cat <<'PROMPT'
You are reviewing the changes on the current branch (HEAD) against `main`
in the NEREIDS repository.
1. Run `git diff main...HEAD` to see all changes.
2. Read each changed file in full.
3. Audit for:
- Logic bugs, panics (unwrap, expect, array indexing)
- Missing input validation
- Numerical stability (division by zero, NaN propagation, overflow)
- Physics correctness (for nereids-physics / nereids-endf)
- API consistency with existing patterns
- Edge cases (empty inputs, zero counts, exactly-determined systems)
4. Report findings as:
- **P1** (must fix) — correctness bugs, panics, data corruption
- **P2** (should fix) — robustness, style, minor improvements
- Include `file:line` references for each finding.
5. If you find nothing significant, say so explicitly. Be terse.
PROMPT
)"
Then read the file at /tmp/codex-review-{branch_slug}.md for the final
review verdict; the JSONL on stdout is the streaming transcript and is
mostly noise for our purposes.
Why these flags:
--sandbox read-only — review only reads code; no need for write access.--skip-git-repo-check — defensive; we always invoke from inside a repo
but this avoids friction in nested-worktree edge cases.-C {worktree_path} — sets working dir explicitly so git diff main...HEAD
resolves correctly per worktree.--output-last-message <file> — captures the agent's final message
cleanly; far easier than parsing JSONL.Known pitfalls (as of April 2026, codex-cli 0.46 → 0.125):
review subcommand was removed (or was never a thing in 0.x). Do
not use codex review --base main — it errors with
unexpected argument '--base' found / Usage: codex <PROMPT>./review, /test, etc.) work only in interactive
TUI sessions; they cannot be invoked from codex exec.~/.codex/config.toml) must
match what the local CLI binary supports. As of 0.46 the default
gpt-5.5 is rejected as "requires a newer version of Codex"; as
of 0.122+ it works. If the binary is too old, upgrade before relying
on Codex review — overriding with -m gpt-5 does NOT help on
ChatGPT-account auth (returns "not supported when using Codex with
a ChatGPT account"). Per-version compatibility is unstable; keep
the binary current.codex exec reads the prompt from stdin if you pass - or omit the
positional, but heredoc-injected positional prompts (as above) are
the most reliable form across versions.--full-auto for review — it grants workspace-write sandbox,
which is broader than the read-only review needs.If Codex fails (network, license, model rejection, binary out of date), note the failure and continue. Codex is supplementary, not blocking. The Claude self-audit is the load-bearing reviewer; Codex provides cross-confirmation when available.
After all reviews complete:
IMPORTANT: If the PR's purpose is P2 burndown or tech debt reduction, the "Defer" category is restricted to findings in a different crate or subsystem than the one being fixed. Same-crate P2s MUST be classified as "Fix now" — otherwise P2 debt accumulates faster than it is paid down.
MANDATORY GATE: Do NOT proceed to Step 5 without user approval. The user must review the consolidation and tell you which findings to fix. End your turn after presenting the report.
Oscillating findings: If a finding reappears after being "fixed", flag it as RECURRING — the user must decide the approach.
After user approves the fix list, launch one
Agent(subagent_type="general-purpose") per worktree in parallel.
Each fix agent must:
cargo fmt --allcargo clippy --workspace --exclude nereids-python --all-targets -- -D warningscargo test --workspace --exclude nereids-pythonscripts/worktree-commit.sh (GPG-signed)After all fix agents complete:
git statusgit push origin {branch}After pushing, check:
After Phase A completes (zero P1s) and branches are pushed:
pixi run copilot-reviews {pr_numbers...} --dedup
MANDATORY: End your turn here and wait for user approval.
Present the user with a concise summary table:
### Pre-Merge Summary — Batch {name}
| PR | Branch | Issue | Key Changes | Review Status |
|----|--------|-------|-------------|---------------|
| #{n} | {branch} | #{issue} | {1-line summary} | Phase A ✓ Phase B ✓ |
**Merge order**: {recommendation}
**Review rounds**: Phase A: {N} round(s), Phase B: {N} Copilot comment(s)
**Findings resolved**: {X} P1s fixed, {Y} P2s fixed, {Z} P2s deferred
**Tests on branches**: {N} Rust tests — all pass
Ready to merge? (User must explicitly approve.)
Do NOT run gh pr merge until the user responds with explicit approval.
After user approves:
gh pr merge --squash --delete-branchgit worktree remove {path} --force for each merged branchgit branch -D {branch} for each/post-merge which handles: pull main, cargo clean && pixi run build,
workspace tests, Python tests, issue verification, memory updatesIMPORTANT: pixi run build must run first after cargo clean. It catches
cross-PR signature mismatches that per-branch reviews miss.
Do NOT skip this step. Create GitHub issues for every P2 finding deferred during consolidation:
file:line referencesWhen launching implementation or fix subagents, ALWAYS include:
pixi run build / pixi run test-python — never
raw maturin develop or pip install."scripts/worktree-commit.sh <worktree-name> '<message>' [files]
for all commits."pixi run gh-issues for issue/PR queries."