Skip to content

ci: add trusted-contributor AI PR review#45

Merged
shawnmuggle merged 2 commits into
masterfrom
chore/trusted-ai-pr-review
Jul 5, 2026
Merged

ci: add trusted-contributor AI PR review#45
shawnmuggle merged 2 commits into
masterfrom
chore/trusted-ai-pr-review

Conversation

@shawnmuggle

Copy link
Copy Markdown
Member

Summary

  • Add a remote GitHub Actions AI PR reviewer for trusted Rozo contributors.
  • Trigger on PR open/update/reopen/ready-for-review and on trusted comments on PRs.
  • Comment P0/P1/P2 findings, label clean PRs with ai-review-passed, and approve only when there are zero P0 findings.

Safety

  • Executes the review script from the default branch checkout only.
  • PR code is fetched only for git diff; it is not executed with secrets.
  • Trusted authors are configured outside the repo file via AI_REVIEW_TRUSTED_AUTHORS.
  • Auto-approve requires separate AI_REVIEW_APPROVER_TOKEN; without it the workflow still reviews/comments but skips approval.

Required config

  • Variable: AI_REVIEW_TRUSTED_AUTHORS.
  • Secret: ANTHROPIC_API_KEY for AI review.
  • Secret: AI_REVIEW_APPROVER_TOKEN for trusted-author approve.

Test plan

  • Parsed workflow YAML locally from the source template.
  • Ran .github/ai_pr_review.py dry-run with a clean mocked review from the source template.

@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
intent-example Ready Ready Preview, Comment Jul 5, 2026 5:27am

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 380258c190

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

echo "author=${{ github.event.pull_request.user.login }}"
echo "base_ref=${{ github.event.pull_request.base.ref }}"
echo "head_repo=${{ github.event.pull_request.head.repo.full_name }}"
echo "head_ref=${{ github.event.pull_request.head.ref }}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Quote PR branch refs before writing them to the shell

When a PR branch contains shell metacharacters such as $(...), this interpolation is placed inside a double-quoted shell command, so Bash still performs command substitution; GitHub documents that most special characters are valid in branch names and need shell escaping. Because this runs before the trust gate, and trusted runs later execute trusted/.github/ai_pr_review.py with the Anthropic/approver secrets, a malicious branch name can rewrite that script and exfiltrate secrets; pass the ref through an environment variable or otherwise single-quote/escape it instead of inlining it into run.

Useful? React with 👍 / 👎.

Comment thread .github/ai_pr_review.py
Comment on lines +355 to +356
if root is None:
return 0.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Persist prior spend before enforcing the daily cap

In the Actions workflow there is no step that sets AGENT_PRIOR_COST_USD or restores a cached brain.db, so in CI this branch returns 0.0 on every run. That makes the advertised daily cap effectively per-run only: multiple PR reviews in the same day can cumulatively exceed $10.00 without the pre-check ever skipping until a single review exceeds the cap by itself.

Useful? React with 👍 / 👎.

Comment thread .github/ai_pr_review.py
Comment on lines +476 to +477
if verdict == "clean":
add_label(repo, pr, token, PASS_LABEL)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove the pass label when a later review blocks

If a PR first gets a clean review, this branch adds ai-review-passed; on a later synchronize run with P0 findings, the non-clean path only skips auto-approval and never removes that existing label. The PR can therefore keep advertising a passed AI review after the current review found blockers, which is misleading for humans or any automation that keys off the label.

Useful? React with 👍 / 👎.

@shawnmuggle shawnmuggle merged commit e09a26f into master Jul 5, 2026
5 checks passed
@shawnmuggle shawnmuggle deleted the chore/trusted-ai-pr-review branch July 5, 2026 07:02
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.

1 participant