Skip to content

Commit 7e6ff27

Browse files
committed
chore(misc): calibrate PR review pipeline from maintainer review feedback (#36433)
(cherry picked from commit 3db1c91)
1 parent 99e7131 commit 7e6ff27

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

.claude/agents/performance-analyzer.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ This applies to an endorsement exactly as it applies to a finding, and matters m
8282
- **Hot path + scales with workspace size** → report (important; critical if it makes any command measurably slower at scale or the daemon leak is unbounded).
8383
- **Warm path + clearly avoidable waste** → report as important only when the fix is straightforward; otherwise endorse with a note.
8484
- **Cold path** → not a finding, no matter how inefficient. A generator that clones an array twice is fine.
85+
- **Weigh a stress test heavily for full-workspace iteration, even on a cold path.** When changed code iterates the entire project/task/candidate set (O(projects) or worse), seriously consider suggesting a stress-test spec at realistic scale (thousands of projects) as an advisory — a scale claim pinned by a test beats one that is only reasoned about. Not a mechanical requirement: skip it when the per-item work is trivially constant and the reasoning is airtight; lean toward asking when the per-item cost is non-obvious (regex/glob work, string algorithms, nested lookups). This is the one softening of the cold-path rule, and it's advisory, never verdict-driving.
8586
- Constant-factor micro-optimizations (`for` vs `forEach`, string concat style) are never findings.
86-
- Don't demand benchmarks — reason from call frequency and input scale, and say so.
87+
- Don't demand benchmarks — reason from call frequency and input scale, and say so. (The stress-test advisory above asks for a unit-level spec, not a benchmark.)
8788

8889
## Verdicts (report exactly one)
8990

.claude/skills/review-pr/SKILL.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: review-pr
3-
description: Deep code review of a single open PR in nrwl/nx. Checks out the PR inside an isolated sandbox container — gVisor on Linux, the Docker VM on macOS — never into the host working tree, runs the pr-review-toolkit review agents, the reproduce-verifier agent (grounds the review in the linked issues and executes the repro inside the sandbox), the alternative-approach agent (independently designs competing solutions and contrasts them with the PR's choice), the performance-analyzer agent (checks the changes don't waste CPU or memory and execute quickly at workspace scale), and the security-analyzer agent (hunts injection-class vulnerabilities — command injection, zip-slip, SSRF, credential leakage — across real trust boundaries), surfaces only critical and important findings (plus strengths; nice-to-have suggestions are dropped), and saves a GitHub-flavored draft to ~/.nx-pr-reviews/<NUMBER>.md for the reviewer to read (nothing is posted). Claude runs on the host and reads/executes the PR code only through `docker exec` — untrusted PR code never runs on the host and Claude's credentials never enter the sandbox. Use when you want a thorough review of one PR.
3+
description: Deep code review of a single open PR in nrwl/nx. Checks out the PR inside an isolated sandbox container — gVisor on Linux, the Docker VM on macOS — never into the host working tree, runs the pr-review-toolkit review agents, the reproduce-verifier agent (grounds the review in the linked issues and executes the repro inside the sandbox), the alternative-approach agent (independently designs competing solutions and contrasts them with the PR's choice), the performance-analyzer agent (checks the changes don't waste CPU or memory and execute quickly at workspace scale), and the security-analyzer agent (hunts injection-class vulnerabilities — command injection, zip-slip, SSRF, credential leakage — across real trust boundaries), surfaces critical and important findings (plus strengths, a terse suggestions list, and explicit maintainer-call decisions), and saves a GitHub-flavored draft to ~/.nx-pr-reviews/<NUMBER>.md for the reviewer to read (nothing is posted). Claude runs on the host and reads/executes the PR code only through `docker exec` — untrusted PR code never runs on the host and Claude's credentials never enter the sandbox. Use when you want a thorough review of one PR.
44
allowed-tools: Bash(gh pr view *), Bash(gh pr list *), Bash(gh pr diff *), Bash(gh issue view *), Bash(gh auth status*), Bash(uname *), Bash(docker run *), Bash(docker exec *), Bash(docker rm *), Bash(docker ps *), Bash(docker inspect *), Bash(docker info *), Bash(docker images *), Bash(git -C *), Bash(git rev-parse *), Bash(mkdir -p *), Bash(rm -f /tmp/pr-*), Bash(rm -f /tmp/repro-*), Bash(mv /tmp/*), Bash(xargs *), Bash(ls *), Bash(printf *), Bash(date *), Bash(cd *), Bash(test *), Bash(echo *), Bash(head *), Bash(tail *), Bash(cat *), Bash(jq *), Bash(grep *), Bash(wc *), Bash(sed *), Write(~/.nx-pr-reviews/**), Write(/tmp/**), Edit(~/.nx-pr-reviews/**), Edit(/tmp/**), Read, Grep, Glob, Skill, Agent
55
argument-hint: '<PR_NUMBER> [--verify-repros]'
66
---
@@ -76,7 +76,8 @@ Parse out:
7676

7777
- `title`, `author.login`, `headRefOid` (the head SHA), `headRefName`, `baseRefName`, `url`
7878
- `isDraft` — if true, exit early (don't review drafts)
79-
- **Local dedup:** if `$TRIAGE_DIR/<NUMBER>.md` exists, its frontmatter `head_sha` equals `headRefOid`, and its `verdict` is not `failed`, this PR was already reviewed at this commit — exit with no draft change; log "ALREADY_REVIEWED". A `failed` draft never blocks a retry. To deliberately re-review an unchanged PR (e.g. after the review criteria changed), delete the draft file or just say so in the session.
79+
- **Local dedup:** if `$TRIAGE_DIR/<NUMBER>.md` exists, its frontmatter `head_sha` equals `headRefOid`, its `pipeline_version` equals the current `PIPELINE_VERSION` (see below), and its `verdict` is not `failed`, this PR was already reviewed at this commit — exit with no draft change; log "ALREADY_REVIEWED". A `failed` draft never blocks a retry. To deliberately re-review an unchanged PR, delete the draft file or just say so in the session.
80+
- **`PIPELINE_VERSION: 2`** — the current review-criteria generation. A draft whose frontmatter has an older `pipeline_version` (or none) was produced by a weaker pipeline: re-review even at an unchanged `head_sha`, treating the old draft as a prior review (Step 4). Bump this constant whenever the review criteria change materially (new agents, new calibrations, new required sections) so stale drafts age out instead of being pinned forever by the SHA dedup.
8081

8182
## Step 3: Check the PR out inside the sandbox container
8283

@@ -381,9 +382,12 @@ only with `docker exec` against that container:
381382

382383
## What to report
383384

384-
Report only **critical** and **important** findings, plus **strengths**. Do not
385-
produce a suggestions / nice-to-have section — polish-level feedback will be
386-
discarded unread.
385+
Report **critical** and **important** findings, plus **strengths**. Concrete,
386+
actionable nice-to-haves (a rename, a restructure, a missing cross-link) may go
387+
in a terse **Suggestions** list — one line each; vague polish will be discarded.
388+
When you endorse a debatable design decision (fail-open vs fail-closed,
389+
normalization, escape hatches, compat trade-offs), say so explicitly in a
390+
**Maintainer calls** line rather than folding it into an endorsement.
387391

388392
Apply the following standing maintainer calibrations; a finding matching one of
389393
these is advisory at most and not worth writing up:
@@ -528,7 +532,15 @@ Aggregate the surviving agents' output into Critical / Important / Strengths you
528532

529533
### Trim to critical + important
530534

531-
**Only critical and important findings are kept.** The charter tells the agents not to produce suggestions; this trim is the backstop for when they do anyway. After capturing `$RAW_REVIEW_BODY`, drop any **Suggestions** / nice-to-have section — discard those findings, do not downgrade or relocate them. Keep **Critical**, **Important**, and **Strengths**. The trimmed text is what flows into the steps below (reconciliation in Step 5b, formatting in Step 6).
535+
**Only critical and important findings drive the verdict.** Keep **Critical**, **Important**, and **Strengths** in full. Suggestions are no longer discarded: distill any **Suggestions** / nice-to-have material into a `### Suggestions` section of at most 5 one-line bullets (`file:line — ask`), keeping only concrete, actionable asks (a rename, a restructure, a doc cross-link) and dropping vague polish. This tier NEVER influences the verdict — it exists because the maintainer's own reviews are largely made of it. The trimmed text is what flows into the steps below (reconciliation in Step 5b, formatting in Step 6).
536+
537+
### Maintainer calls
538+
539+
The review body must include a `### Maintainer calls` section whenever the review _endorsed_ a debatable design decision on the maintainer's behalf — fail-open vs fail-closed, normalize-then-compare vs exact comparison, an opt-out escape hatch left permissive, compat-driven leniency, a documented trade-off accepted as-is. One line each: the decision, the stricter/alternative option, and why the PR's choice was endorsed. These are the judgments a human most often overrides — burying them inside Strengths or an agent's endorsement hides exactly the calls the maintainer wants to veto. If there are none, omit the section.
540+
541+
### Docs direction (when the diff touches `astro-docs/`)
542+
543+
Review changed docs for _editorial direction_, not just factual accuracy: does the page recommend a practice the team shouldn't encourage (e.g. sharing a daemon across containers — a remote-code-execution vector), does it frame an escape hatch as a primary use case, does a new env var/flag doc link back to the concept page that explains its risks? A doc that accurately describes a bad recommendation is a finding, not a strength. Rate genuinely harmful guidance Important; wording/positioning asks go under Suggestions.
532544

533545
### Nx-specific calibration
534546

@@ -784,7 +796,7 @@ Capture the agent's output as `$REPRO_REPORT`. Fold it into the final review bod
784796

785797
## Step 5b: Reconcile against prior reviews (only on re-review)
786798

787-
If a prior review exists, do a second pass _yourself_ (don't dispatch another agent — you already have all the context). Work only from the trimmed findings (critical / important Suggestions were already dropped in Step 5). For each finding:
799+
If a prior review exists, do a second pass _yourself_ (don't dispatch another agent — you already have all the context). Work from the trimmed critical / important findings (the Suggestions and Maintainer-calls sections carry over as-is, refreshed for the new diff). For each finding:
788800

789801
- Was the same concern raised in a prior review and now appears resolved? → move it under **Addressed since last review**.
790802
- Was the same concern raised in a prior review and still present? → move it under **Still concerning** with a note like "raised in <date>".
@@ -861,6 +873,7 @@ head_sha: <HEAD_REF_OID>
861873
last_reviewed_at: <ISO_8601>
862874
verdict: <lgtm|needs-changes|blocked|superseded|unnecessary|failed>
863875
attempt: <N>
876+
pipeline_version: <PIPELINE_VERSION>
864877
posted_at:
865878
posted_url:
866879
---

0 commit comments

Comments
 (0)