feat(pr-reviewer): label + author gates and already-merged skip

Merged
KH
6mo ago
+151-2

User description

What

Adds three agent-side gates to the pr-reviewer, evaluated before it reviews/fixes a PR:

  1. Label gate — skip the reviewer entirely when the PR carries a disabling label. Configurable via the new SKIP_LABELS input (comma-separated); defaults to no-agent-relay-review.
  2. Author allowlist — new REVIEW_AUTHORS input. When set, only review/fix PRs opened by those GitHub logins (e.g. only my own PRs). Unset = every author, so existing deployments are unaffected (mirrors the APPROVERS pattern).
  3. Already-merged/closed skip — don't post a stale review when the PR has already merged/closed by the time the handler runs.

How

  • Author + labels are read from the live PR meta.json via readJsonFile (the same pattern repo-hygiene uses), because the webhook payload doesn't carry them on every trigger — check_run.completed has neither author nor labels.
  • The meta read is best-effort: on failure it falls back to the payload author and proceeds (fail-open), so a flaky read never silently blocks reviews.
  • Gates apply only to the review/fix path. Merge-on-approval is unchanged and still governed by APPROVERS.
  • tsc --noEmit passes.

Scope / follow-ups

The already-merged skip is the cheap, agent-side half of the merge-race. Preserving the unpushed fixes via a recovery PR + Slack confirm needs platform work that isn't possible in this repo (no durable cross-turn session, and inbound Slack messages aren't delivered to agents) — tracked in AgentWorkforce/cloud#1659 (Slack delivery) and AgentWorkforce/cloud#1660 (CF continuation runtime).

Also drops a stale Daytona/Codex sandbox comment in persona.ts that was already modified in the working tree.

🤖 Generated with Claude Code


Summary by cubic

Add agent-side gates to the PR reviewer to skip runs based on labels, author allowlist, and already-merged state, reducing noisy or stale reviews.

  • New Features
    • Skip when PR is merged or closed; optional Slack notice via SLACK_CHANNEL.
    • Disable via label with SKIP_LABELS (default: no-agent-relay-review).
    • Only review authors in REVIEW_AUTHORS (comma-separated). Unset = review everyone.
    • Read author/labels/state from pulls/{n}/meta.json with fail-open fallback; accepts meta.author as a string or { login }, validates label names, and fails open when author is unknown; gates only affect review/fix and do not change merge-on-approval via APPROVERS.
    • Persona exposes REVIEW_AUTHORS and SKIP_LABELS.

CodeAnt-AI Description

Skip review runs for closed PRs and PRs that should not be reviewed

What Changed

  • The PR reviewer now skips work when the PR is already merged or closed, avoiding stale comments and reviews
  • The reviewer can now be disabled by label and limited to specific PR authors through new settings
  • When a PR is skipped, it can post a Slack note explaining why
  • Several agents now send GitHub and Slack actions through shared helper clients instead of the older writeback flow
  • Linear, Slack, GitHub, and merge actions continue to behave the same for users, but with the updated helper-based routing

Impact

✅ Fewer stale PR reviews
✅ Fewer unwanted review runs
✅ Clearer skip messages in Slack

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.