Skip to content

[TEST] Add two-stage auto PR review with Claude (comment-only, no merge)#3801

Open
sekyondaMeta wants to merge 11 commits into
mainfrom
autoClaudeReview
Open

[TEST] Add two-stage auto PR review with Claude (comment-only, no merge)#3801
sekyondaMeta wants to merge 11 commits into
mainfrom
autoClaudeReview

Conversation

@sekyondaMeta
Copy link
Copy Markdown
Contributor

  • Stage 1 (claude-pr-review.yml): Captures PR number on PR open, no AI/secrets
  • Stage 2 (claude-pr-review-run.yml): Runs Claude review in protected bedrock environment with script-generated facts section and COMMENT-only output
  • Harden claude-code.yml with --allowedTools Skill (matches pytorch main repo)
  • Update pr-review skill: SECURITY block, COMMENT-only policy, advisory labels

Security: Claude cannot merge, approve, push, or execute commands. Reviews are advisory COMMENT-only. Script-generated facts provide injection-resistant anchor.

- Stage 1 (claude-pr-review.yml): Captures PR number on PR open, no AI/secrets
- Stage 2 (claude-pr-review-run.yml): Runs Claude review in protected bedrock
  environment with script-generated facts section and COMMENT-only output
- Harden claude-code.yml with --allowedTools Skill (matches pytorch main repo)
- Update pr-review skill: SECURITY block, COMMENT-only policy, advisory labels

Security: Claude cannot merge, approve, push, or execute commands. Reviews are
advisory COMMENT-only. Script-generated facts provide injection-resistant anchor.
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Mar 19, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3801

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit a8cfbe2 with merge base a6be3f1 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the cla signed label Mar 19, 2026
@sekyondaMeta sekyondaMeta marked this pull request as ready for review March 19, 2026 19:42
…ermission

- Remove lintrunner install + run (already handled by lintrunner.yml workflow)
- Remove issues:write permission (only PR comments needed, not issue writes)
- Keep id-token:write (required for AWS OIDC → Bedrock auth)
Comment thread .github/workflows/claude-pr-review-run.yml Outdated
Comment thread .github/workflows/claude-pr-review-run.yml
…al git diff, collapsible output

- Checkout at exact PR head SHA so Claude reviews the actual changed code
- Switch from gh pr diff (GitHub API) to local git diff
- Workflow assembles final comment (facts + Claude analysis + footer)
  so Claude never touches the facts section (prompt injection defense)
- Claude produces only its analysis, workflow posts via gh pr comment
- Update SKILL.md output format to collapsible <details> blocks
- Add CI auto-review mode instructions to SKILL.md
- Preserve tutorials-specific fact checks (card entry, thumbnail, deps)
Comment thread .claude/skills/pr-review/SKILL.md Outdated
Comment thread .claude/skills/pr-review/SKILL.md Outdated
Comment thread .github/workflows/claude-pr-review-run.yml Outdated
Comment thread .github/workflows/claude-pr-review-run.yml
sekyondaMeta and others added 3 commits April 15, 2026 15:38
…nt jobs

Address PR review feedback from ZainRizvi:

1. Split single 'review' job into two jobs:
   - analyze: runs Claude with pull-requests:read only, uploads artifacts
   - post-comment: downloads artifacts, posts comment with pull-requests:write (no Claude)

2. Trim SKILL.md noise — remove workflow file references, CI environment
   details, permissions tables, trigger mechanics. Deduplicate repeated
   instructions (COMMENT-only rule, CI output format, review areas).
   292 → 175 lines.

3. Fix post-comment permissions — add contents:read for checkout step.

4. Fix execution file discovery — copy to known path (claude-execution.json)
   before upload instead of fragile find command with precedence bugs.
@svekars svekars requested review from malfet and svekars April 21, 2026 18:20
@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 20, 2026

Hi @sekyondaMeta!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants