Skip to content

ci: add trusted-contributor AI PR review#13

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

ci: add trusted-contributor AI PR review#13
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)
rozo-deeplink-demo Ready Ready Preview, Comment Jul 5, 2026 5:31am

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: 9f40177f4f

ℹ️ 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".

Comment thread .github/ai_pr_review.py
Comment on lines +117 to +118
if len(diff) > DIFF_CHAR_BUDGET:
diff = diff[:DIFF_CHAR_BUDGET] + "\n\n[... diff truncated for length ...]"

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 Fail closed when truncating the PR diff

For any PR whose unified diff exceeds 200 KB, this silently drops the tail and still lets the run produce a normal clean verdict. If a P0 issue appears after the truncation point, the script can add ai-review-passed and submit the trusted-author approval even though that part of the PR was never reviewed; treat truncation as non-approvable or surface it as a blocking/skip state.

Useful? React with 👍 / 👎.

Comment thread .github/ai_pr_review.py
Comment on lines +178 to +179
findings: dict[str, list[str]] = {"P0": [], "P1": [], "P2": []}
matches = list(_SECTION_RE.finditer(review_md))

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 Fail closed on unparseable model output

If Claude returns markdown without the exact ## P0/## P1/## P2 headings, returns an empty response, or is truncated before those headings, matches is empty and the default empty findings make verdict_from_findings() return clean. That can label and approve a PR even though the review result was malformed, so missing required sections should be treated as a review failure rather than as zero findings.

Useful? React with 👍 / 👎.

Comment on lines +121 to +122
# Budget guardrails (override per repo if needed).
AI_REVIEW_DAILY_USD_CAP: "10.00"

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 relying on the daily cap

This workflow sets a daily cap but never supplies AGENT_PRIOR_COST_USD or restores the cached artifact that read_prior_cumulative_cost() expects; in Actions there is also no local brain.db, so every run starts with prior cost 0.0. A busy day of PR updates or trusted comments can therefore exceed the intended daily cap as long as each individual review is under $10.

Useful? React with 👍 / 👎.

Comment thread .github/ai_pr_review.py
Comment on lines +499 to +500
else:
set_output("trusted_auto_approve", "skipped-p0")

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 stale pass labels on blocking reviews

When a PR was previously clean, this script adds ai-review-passed; on a later synchronize run that finds a P0, the non-clean path only records an output and never removes the old label. That leaves the PR marked as passed on a revision with blocking findings, which can mislead any humans or automation that key off the label.

Useful? React with 👍 / 👎.

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