Skip to content

ci: acknowledge /review comments - #29

Merged
psgundecha-nv merged 3 commits into
mainfrom
ci/ai-review-acknowledge
Dec 1, 2026
Merged

psgundecha-nv merged 3 commits into
mainfrom
ci/ai-review-acknowledge

Conversation

@psgundecha-nv

@psgundecha-nv psgundecha-nv commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

A /review comment starts a run that GitHub attaches to main, not to the PR. Nothing on the PR showed that the review had started until its result arrived a few minutes later, and a skipped command said nothing at all.

  • Accepted command: a new acknowledge job adds an "eyes" reaction to the comment as soon as authorization passes.
  • Skipped command: when someone with write access asks for a review that can't run, the job replies with why: the PR is a draft or from a fork, targets a branch other than main, or the last review already covers its latest commit.
  • No reply to anyone else, so someone without write access can't make the bot post.
  • Small blast radius: the job runs no code from the repository and receives event values through environment variables. Its only permission is issues: write. GitHub's permission tables for apps and tokens list reactions on comments under Issues only, so pull-requests: write would make every reaction fail. Issues write also covers the reply, which goes through the issue-comments endpoint.
  • Docs: AGENTS.md and CONTRIBUTING.md describe the reaction and the reply.

Validation

  • pytest tests/ locally: everything passes except four tests/test_downstream_install.py cases that build editdistance from source, which doesn't compile on macOS. CI runs them.
  • The new tests fail in each of these cases:
    • a skip loses its reason;
    • the reaction is posted for a skipped command;
    • the job's condition is loosened, for example to always();
    • the permission reverts to pull-requests: write;
    • the reaction is sent with the wrong HTTP method;
    • the reply goes back to gh pr comment.
  • actionlint is clean. zizmor reports only the issue_comment trigger finding that main already has.
  • pre-commit run --all-files: passed.
  • A live check needs the merge, because GitHub runs issue_comment workflows from main. After merging, comment /review on an open PR.

Plan or run evidence

N/A: the change is limited to the AI review workflow. It doesn't change what any workflow plans or submits.

Compatibility

None for workflow YAML, the CLI, project contracts or cluster configs.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally (scripts/run_ci_test_lane.sh nemo and scripts/run_ci_test_lane.sh minimal), or N/A for docs-only changes. The full suite passed locally apart from the four macOS-only build failures above; both lanes run in CI.
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (uv run pre-commit run --all-files).
  • New source files include the NVIDIA Apache-2.0 license header. N/A: no new files.
  • Nothing in the change exposes credentials, internal hostnames or paths, or unreleased model names; this repository is public.
  • All commits have DCO sign-off (git commit -s).

A /review run belongs to main, so nothing on the PR showed it had started, and a skipped command said nothing. React with eyes to an accepted command, and reply with the reason when someone with write access asks for a review that can't run. No one else gets a reply.

The new job holds only pull-requests: write and runs no repository code.

Signed-off-by: Pritam Gundecha <pgundecha@nvidia.com>
@psgundecha-nv
psgundecha-nv requested a review from a team December 1, 2026 22:48
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

AI review of 0310039 (model aws/anthropic/bedrock-claude-sonnet-5-5). Advisory only: a maintainer's approval is still required.

Verdict: SHIP

The change is low-risk. The new acknowledge job runs no repository code and uses only static or trusted strings. Its token is limited to pull-requests: write, and it doesn't touch the review path or the inference key. I found no BLOCKERs or RISKs. The one open question is the reactions API permission, below.

NOTE

  • .github/workflows/ai-review.yml:72: the reactions call under pull-requests: write. I can't confirm from the code here that the GITHUB_TOKEN with only pull-requests: write may POST to issues/comments/{id}/reactions. gh pr comment on the same permission already works in post and report-failure. If the permission is insufficient, every accepted /review ends with a red acknowledge job and no reaction. The review itself would still run, because review doesn't depend on acknowledge. You noted that a live check needs the merge. Could you confirm against the Actions permissions docs, or be ready to add issues: write if the first live run fails?

  • .github/workflows/ai-review.yml:55-57 and tests/test_github_workflows.py:195: the "no reply to anyone else" guarantee isn't pinned. That guarantee rests on run == 'true' || skip_reason != '', and on skip_reason staying unset for requesters without write access and for /reviewer-... comments. The harness test covers the skip_reason side (told_why=False for those two cases). The workflow test only checks that the if starts with github.event_name == 'issue_comment' &&. Suggestion: assert the full if string, so a later edit such as dropping the skip_reason clause or loosening it to always() fails a test.

  • .github/workflows/ai-review.yml:109-112: repeat replies on an unchanged head. Each /review from a writer on an already-reviewed commit now produces another bot comment saying the last review already covers it. That's the intended feedback, and I see no loop: the reply doesn't start with /review or the review marker. It does mean that spamming the command spams the PR. This is only worth acting on if it shows up in practice.

  • tests/test_ai_review_workflow.py:174-180: the reaction test covers only the script. It asserts the gh api ... reactions -f content=eyes call and the pr comment body. The -X POST and --silent flags are outside the asserted substring, so it won't catch a wrong HTTP method. That's acceptable for a fake gh, but the live run after merge is the real check.

Generated by the AI review workflow from AGENTS.md and .agents/skills/pr-review/SKILL.md. Comment /review to review new commits, or /review full to start over.

Reacting to a comment needs the Issues permission; pull-requests: write does not cover it, so every reaction would have failed. Post the skip reply through the issue-comments endpoint, which issues: write covers, and say that marking a draft ready starts the review. Pin the job's full condition and the exact API calls in the tests.

Signed-off-by: Pritam Gundecha <pgundecha@nvidia.com>
@psgundecha-nv

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Follow-up AI review of df8525d (model aws/anthropic/bedrock-claude-sonnet-5-5). Advisory only: a maintainer's approval is still required.

Verdict: SHIP

I reviewed the changes since 0310039 against the whole PR. No new findings.

Status of earlier findings

  • Reactions call under pull-requests: write: fixed. The acknowledge job now has issues: write only (.github/workflows/ai-review.yml:322-324). The reply moved from gh pr comment to gh api -X POST .../issues/$PR_NUMBER/comments (line 338), so both calls go through the Issues endpoints that permission covers. I can't confirm the token scopes from the repository itself. The first live /review after merge is the real check. If it's wrong, the failure is a red acknowledge job and a missing reaction. The review would still run, because review and report-failure don't depend on acknowledge.
  • "No reply to anyone else" guarantee not pinned: fixed. tests/test_github_workflows.py:82-85 now asserts the full if expression. Dropping the skip_reason clause or loosening it to always() fails that test. The harness test in tests/test_ai_review_workflow.py still checks that skip_reason stays unset for no-write requesters and for /reviewer-notes.
  • Repeat replies on an unchanged head: still open, no change needed. Each /review from a writer on an already-reviewed commit gets another "already covers this commit" comment. I see no loop. The reply doesn't start with /review or the review marker, and a GITHUB_TOKEN comment doesn't trigger the workflow. It's only worth acting on if it becomes noisy in practice.
  • Test asserted only a substring of the call: fixed. tests/test_ai_review_workflow.py:181-189 now asserts the whole argument line, -X POST and --silent included. The fake gh records any -X POST call (line 44), so a wrong method or a switch back to gh pr comment would fail.

Review of the new changes

  • The draft message now reads "Marking the PR ready for review starts it." This matches the ready_for_review trigger. The test string at tests/test_ai_review_workflow.py:186 is updated to match.
  • The acknowledge job still runs no repository code. It has no uses: step, and tests/test_github_workflows.py:211 pins that. Event-derived values reach the script only through env:.
  • skip_reason is written with printf '%s'. Every message is a single line, built from static text and $DEFAULT_BRANCH, so it can't inject extra GITHUB_OUTPUT keys.
  • When vars.CLAUDE_MODEL is unset, authorize is skipped. acknowledge then skips too, because its implicit success() fails on a skipped dependency. The workflow stays fully off, as its header comment says.

I confirmed that no plan or submission behavior changes. The diff touches only the AI review workflow, its tests, and two docs. The docs match the new behavior.

Generated by the AI review workflow from AGENTS.md and .agents/skills/pr-review/SKILL.md. Comment /review to review new commits, or /review full to start over.

@wowowoxuan1994 wowowoxuan1994 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm, approved, thx.

@psgundecha-nv
psgundecha-nv merged commit 6e38a58 into main Dec 1, 2026
8 checks passed
@psgundecha-nv
psgundecha-nv deleted the ci/ai-review-acknowledge branch December 1, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants