Skip to content

ci: check the PR author's self-review and its resolution - #5348

Merged
terrykong merged 22 commits into
mainfrom
terryk/self-review-check
Nov 22, 2026
Merged

terrykong merged 22 commits into
mainfrom
terryk/self-review-check

Conversation

@terrykong

@terrykong terrykong commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator
  • I, the PR author, have personally reviewed every line of this PR.

What and why

Stacked on #5347. That PR makes review-pr-team sign its reviews with a hidden marker (harness, model, effort, skill revision, reviewed commit). This PR adds the CI check that reads it, so every PR shows whether its author has done a real self-review and dealt with every comment from it.

flowchart LR
  E[PR pushed/edited, review or review comment] --> A{author's review with kind=self marker?}
  A -- no --> N[✗ No self-review]
  A -- yes --> P{marker allowed by policy and skill rev within 3 of main?}
  P -- no --> X[✗ Not accepted: reason]
  P -- yes --> T{every self-review thread replied to and resolved?}
  T -- no --> R[✗ Not resolved: N of M]
  T -- yes --> OK[✓ Resolved]
Loading
  • Self-review commit status, posted by .github/workflows/self-review-check.yml using .github/scripts/check_self_review.py (stdlib; pure functions so GitLab CI can reuse them). The description shows the state, e.g. Not resolved: 2 of 5 threads open or unanswered.
  • Not accepted when the marker's harness, model or effort is not in skills/review-pr-team/self-review-policy.json, or its skill revision is more than 3 behind main.
  • REVISION bump check: a PR that changes skills/review-pr-team/ fails unless it bumps REVISION by exactly one. This PR changes the skill (one line in its revision section), so it bumps REVISION to 2.
  • The script and policy are read from the default branch only, never from the PR. Warning-only for now: not a required check.
  • Known limits: GitHub has no "thread resolved" trigger, so the status refreshes on the next push, edit, review or comment. For PRs from forks, review events get a read-only token, so the status refreshes on the next push or edit.

Issues

None

Convergence / perf / functionality proof

N/A: CI only; no training code.

  • No unit tests: the check is tested live on fork PRs instead (see the screenshot comment on this PR).
  • Live on a fork with a test-only pull_request trigger: a new PR showed No self-review; after an Opus self-review with one inline comment, Not resolved: 1 of 1; after a reply only, still Not resolved: 1 of 1; after reply + resolve + an edit, Resolved (1 threads). A self-review marked claude-sonnet-5-5 showed Not accepted: model claude-sonnet-5-5 is not allowed. No run failed.

Needs upstream changes

#5347 (this PR is stacked on it).

PR commands and CI
  • /ok to test <full-commit-sha>: start CI for that commit. Post again after each push.
  • /review: automated review comments. Add mode=strict for a stricter review, reset=true for a fresh full review.
  • /resolve-conflict: Autobot merges main into this PR and resolves the conflicts.

🤖 Generated with Claude Code

…sion reviews

Prerequisite for a self-review CI check. review-pr-team now:
- runs scripts/review_identity.py preflight first. It stops if this
  session wrote code in the PR (its own Claude Code or Codex transcript
  shows edits to the PR's files, or a commit/push in the repo). For a
  self-review (reviewer is the PR author), it also stops when the
  harness, model or effort is not on self-review-policy.json's list.
- ends the review body with a footer from the same script: a visible
  line and a hidden <!-- nemo-rl-review: ... --> marker with kind,
  harness/version, model, effort, skill revision and reviewed commit.
  These come from env vars and the session transcript, not the model.
- as an expert review, re-checks the author's self-review threads
  after its own findings are final.
- has a REVISION number, bumped only in PRs that change the skill.

Tested in fresh Claude Code (Opus allowed, default Sonnet rejected)
and Codex (gpt-6-astra allowed, on system Python 3.9) sessions.

Signed-off-by: Terry Kong <[email protected]>
A new "Check self-review" workflow posts a `Self-review` commit status:
- No self-review: the author has not published a review whose body has
  review-pr-team's `kind=self` marker.
- Not accepted: <reason>: the marker's harness, model or effort is not in
  skills/review-pr-team/self-review-policy.json, or its skill revision is
  more than max_revision_lag behind main.
- Not resolved: N of M: a thread from the self-review has no reply or is
  not resolved.
- Resolved (M threads).

It also fails when a PR changes skills/review-pr-team/ without bumping
REVISION by exactly one, so this PR bumps it to 2.

The workflow reads the script and policy from the default branch only.
It is warning-only (not a required check). The logic is pure functions
in .github/scripts/check_self_review.py (stdlib) so GitLab can reuse it.

Signed-off-by: Terry Kong <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 21, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the CI Relating to CI label Nov 21, 2026
@terrykong terrykong added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Nov 21, 2026
@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 2cc5a74

@terrykong

Copy link
Copy Markdown
Collaborator Author

/review

@terrykong

terrykong commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Every outcome of the Self-review check, tested on the fork (updated for head 5bd5bdada3: one-line footer, new "found without footer" state, vN revisions)

I copied this PR's check script, policy and REVISION, unchanged, to my fork's test base (proto/self-review, REVISION 2) and opened one test PR per state. The "too old" PR targets a second base, proto/self-review-r16, whose REVISION is 16. Each screenshot is the real Self-review row from that PR's checks popup, taken logged out.

The test reviews were posted through the API with a footer in the format review_identity.py footer prints, for example `nemo-rl-review: kind=self harness=claude-code/2.1.330 model=claude-opus-5-5 effort=medium review-pr-team=v2 reviewed=<sha>`. Each case changes one field.

1. No self-review. The author has posted no review. (fork #47)

No self-review

2. Review without the footer. The author posted a review with text, but not through /review-pr-team, so there's no footer line. Empty-body reviews, which GitHub creates for thread replies, don't count. (fork #48)

No footer

3–7. Not accepted. The footer is there, but the policy rejects it.

Footer field Fork PR
3 harness=cursor/1.0 (not Claude Code or Codex) #49
4 model=claude-sonnet-5-5 (not on the allow-list) #50
5 effort=low (below medium) #51
6 review-pr-team=v2 while the base is at v16 (more than 3 behind) #52
7 no review-pr-team= field #53

Harness not allowed
Model not allowed
Effort too low
Too old
No revision

8. Not resolved. An accepted self-review left one inline comment that nobody has answered. (fork #54)

Not resolved

9. Resolved. Same as 8, but the thread got a reply and was resolved. (fork #55)

Resolved

GitHub fires no event when a thread is resolved, so the status changed only after the next PR edit (here, a description edit). A push, a new review or a review comment also refreshes it.

10. REVISION not bumped. The PR changes a file under skills/review-pr-team/ without bumping REVISION over the base. The Self-review status is green (an accepted self-review with no threads), but the check job fails and says what to fix. (fork #56)

Self-review status
Failing job
Job annotation

Notes:

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found three correctness issues in the new check.

I inspected all five changed files and their directly affected paths. Three topic reviewers ran; one finished without a delivered report, so I inspected the client and test-integration paths myself. This was a source-only review. I did not run tests or lint, and live CI results were unavailable.

Generated by Codex

Review generated by codex. This was a full review. Request a full review with /review reset=true.

Comment thread .github/workflows/self-review-check.yml Resolved
Comment thread .github/scripts/check_self_review.py Resolved
Comment thread .github/scripts/check_self_review.py Resolved
…e footer to the reviewed commit

Fixes Autobot findings C1-C5 and C7 on #5347:
- Shell commands that write a PR file (redirects, tee, cp/mv/install,
  sed -i, perl -i) now count as edits, as Edit/Write already did.
- git commit/push is found by parsing the command, so quoted text
  such as printf 'git commit' and Codex patch bodies no longer match.
- Paths and git directories are resolved against the tool's working
  directory, `cd` and `git -C`, and must be inside this repo.
  A matching file suffix in another checkout, or a sibling directory
  such as /repo-copy, no longer counts.
- Claude tool calls whose result was an error are skipped.
- `footer` now needs --head <reviewed SHA> and refuses to print if
  the PR head has moved since.
- Docstring: Claude effort comes from CLAUDE_EFFORT, not the transcript.

Signed-off-by: Terry Kong <[email protected]>
Read every page of review threads, so a self-review thread after the first
100 still counts. Put review events from fork PRs in their own concurrency
group, so their read-only runs can't cancel a run that can post the status.

Signed-off-by: Terry Kong <[email protected]>
@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 17af32b

Fixes Autobot C6 on #5347, using the "require gh" option.
- SKILL.md and runtime/codex.md now say `gh` (logged in) is required.
  codex.md no longer describes a no-gh HTTP path.
- review_identity.py exits with an install hint when `gh` is missing,
  instead of a traceback.

Signed-off-by: Terry Kong <[email protected]>
A PR that changes skills/review-pr-team/ must set REVISION to the base's
value plus one, read from the base commit as data. Stacked PRs and PRs into
release branches no longer fail when their base differs from main. Main's
REVISION still decides whether a self-review is too old.

Signed-off-by: Terry Kong <[email protected]>
From the author's self-review on #5347:
- C1: preflight also reads Claude Code subagent transcripts
  (<sid>/subagents/*.jsonl), so edits made by subagents count.
- C3: the re-check of the author's self-review threads is now
  comment-reviewer's Wave 1 task 5, so reopened threads go through
  devil-advocate and comment-editor. It matches the script's
  "Review kind: expert" output.
- C4: the CI check that reads the marker and enforces REVISION comes
  in the next PR; SKILL.md now says so in future tense.

Signed-off-by: Terry Kong <[email protected]>
@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 7febea0

…o babysit-5348

Signed-off-by: Terry Kong <[email protected]>

# Conflicts:
#	skills/review-pr-team/SKILL.md
@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 206ab8a

@terrykong

Copy link
Copy Markdown
Collaborator Author

/review

Narrows the C6 fix on #5347. runtime/codex.md goes back to its
3b3c562 text, which keeps the no-gh HTTP transport for the rest of
the workflow. SKILL.md Phase 0.1 and review_identity.py's error now
say that only the identity preflight needs `gh`.

Signed-off-by: Terry Kong <[email protected]>

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for this follow-up. I verified that the three earlier findings are fixed in the current source:

  • C1: The concurrency expression separates read-only fork review runs from writable PR-update runs. Same-repository updates and reviews still share a group.
  • C2: The thread collector accumulates pages and follows the cursor until no next page exists. The regression test checks that an unanswered self-review thread after 100 unrelated threads produces a failure.
  • C3: The revision check compares head with base plus one. The entry-point test covers main 5, base 2 and heads 2, 3 and 4, while checking that freshness still receives main's revision.

I compared the subsequent changes with the previously reviewed tree and traced their directly affected contracts. No unresolved prior findings or introduced regressions eligible above the historical moderate-impact ceiling remain. This was a follow-up, not a fresh whole-PR review.

Three topic reviewers ran. Two delivered reports; the pagination reviewer finished without a delivered report, so I inspected that topic myself. Validation was source-only. I did not run tests or lint, and live CI results were unavailable.

Generated by Codex

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

The self-review check now reads the last line that starts with
nemo-rl-review: (backticks ignored) and takes the skill revision from
review-pr-team=vN. The old <!-- nemo-rl-review: ... skill_rev=N --> form is
no longer read. Lines with another prefix, such as doc examples, and
mentions inside a sentence don't count.

Signed-off-by: Terry Kong <[email protected]>
The footer is now a single code span, with no hidden HTML comment:

  `nemo-rl-review: kind=self harness=claude-code/2.1.330 model=claude-opus-5-5 effort=medium review-pr-team=v1 reviewed=3672697`

Keys always come in this order: kind, harness, model, effort,
review-pr-team (v + REVISION), and reviewed (7-char head). `--head` is
still required, and the script still refuses if the head has moved.
SKILL.md Phase 5, the Skill revision section, and the footer line in
runtime/codex.md show the new line. REVISION stays 1.

Signed-off-by: Terry Kong <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 21, 2026

Copy link
Copy Markdown

/ok to test fd8df7fda5c5ff24ba8b46c6d8d64b11ec8b23d2

@terrykong, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 1060017

@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 70d59f6

@terrykong
terrykong marked this pull request as ready for review November 21, 2026 07:22
@terrykong
terrykong added this pull request to stack #5352 November 21, 2026 07:30
@terrykong terrykong added CI:docs Run doctest and removed CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) labels Nov 21, 2026
@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 23e9264

@terrykong
terrykong enabled stacked auto-merge (squash) November 21, 2026 07:34
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 21, 2026 07:34
@terrykong

Copy link
Copy Markdown
Collaborator Author

/review-approve

@terrykong
terrykong disabled stacked auto-merge November 21, 2026 07:36

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for this follow-up. I found no unresolved prior findings or introduced regressions eligible above the historical moderate-impact ceiling.

I rechecked the earlier fixes against the current source:

I compared the subsequent footer migration and missing-footer handling with the previously reviewed tree, then traced the affected producer, policy and status-writing paths. This was not a fresh whole-PR review.

All three topic reviewers delivered reports. Validation was source-only. I did not run tests or lint, and live CI results were unavailable.

Generated by Codex

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

From the author's end-to-end self-reviews on #5347:
- C8: heredoc bodies are dropped before lexing, and commands are lexed
  line by line, so a `#` comment or a stray quote hides only its own
  line. A quote that spans lines (multi-line `git commit -m`) still lexes.
- C9: the PR's file list comes from the paged REST endpoint, so PRs
  with more than 100 files are fully covered.
- C10: codex.md says the CI Self-review check comes in the next PR.
- C17: paths and the repo root are resolved with realpath, so edits
  through a symlinked alias still match the PR's files.

Signed-off-by: Terry Kong <[email protected]>
@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 639239a

@terrykong

Copy link
Copy Markdown
Collaborator Author

/review-approve

@terrykong
terrykong enabled stacked auto-merge (squash) November 21, 2026 09:19
@terrykong

Copy link
Copy Markdown
Collaborator Author

/review-approve

@terrykong
terrykong disabled stacked auto-merge November 22, 2026 00:22
Base automatically changed from terryk/self-review-identity to main November 22, 2026 00:22
@terrykong

Copy link
Copy Markdown
Collaborator Author

/resolve-conflict

Signed-off-by: Terry Kong <[email protected]>

# Conflicts:
#	skills/review-pr-team/REVISION
#	skills/review-pr-team/SKILL.md
@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 51e0db6

@terrykong

Copy link
Copy Markdown
Collaborator Author

/review-approve

@terrykong
terrykong merged commit 488ff3b into main Nov 22, 2026
50 checks passed
@terrykong
terrykong deleted the terryk/self-review-check branch November 22, 2026 01:52
yfw added a commit that referenced this pull request Nov 24, 2026
…kind-advantages

Brings in 8 commits, including the BaseModel environment configs (#5234),
the BaseModel EvalConfig (#4909), the pipelined prefix writer (#5176) and the
self-review status check (#5348). No conflicts. The two GRPO configs pick up
main's new math verifier_type key next to this PR's masked_reward_policy
comments.

Main's ledger schema is still 8, so failure_kind stays in schema 9. The Gym
pin is the same on both sides (9e2e5d0ad0).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:docs Run doctest CI Relating to CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants