Repository navigation
feat: add review queue and PR fixer GitHub Actions - #874
Conversation
- Rename PR Merge Review to Review Queue with updated prompt for type classification and sub-agent evaluation - Add PR Fixer workflow with 4 triggers: - Label: agent-managed label added to PR (immediate) - Comment: @ambient-fix from collaborators (immediate) - Schedule: every 4 hours weekdays for agent-managed PRs - Manual: workflow_dispatch with PR number - Batch job finds agent-managed PRs with recent activity, fires off parallel Ambient sessions (no wait) - Remove unused SESSION_RESULT env var Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis pull request introduces a new GitHub Actions workflow for automated PR fixing with multiple trigger modes (labeled events, issue comments, scheduled runs, manual dispatch), alongside renaming and updating the existing PR review workflow. The new workflow coordinates single-PR fixes, batch discovery, and parallel processing. Changes
Sequence Diagram(s)sequenceDiagram
actor Trigger
participant GHA as GitHub Actions
participant Batch as fix-batch Job
participant Single as fix-single Job
participant Matrix as fix-each Job
participant API as ambient-action API
participant Output as Workflow Output
Trigger->>GHA: Manual dispatch / PR labeled / Schedule / Comment `@ambient-fix`
alt Single Fix Path
GHA->>Single: Trigger (PR event or `@ambient-fix` comment)
Single->>Single: Determine PR number
Single->>API: Invoke ambient-action with PR + prompt
API-->>Single: Session created
Single->>Output: Emit session summary (name, UID, phase)
else Batch Fix Path
GHA->>Batch: Trigger (scheduled on weekdays)
Batch->>Batch: gh pr list: find agent-managed PRs<br/>updated in last 4 hours
Batch->>Batch: Filter via Python to get eligible PRs
Batch->>Output: Output JSON array of PR numbers
Output->>Matrix: Matrix input (PR list)
Matrix->>API: Parallel invocations of ambient-action<br/>(wait=false for each PR)
API-->>Matrix: Sessions created (non-blocking)
Matrix->>Output: Emit per-PR session summary
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude Code Review Summary PR 874 introduces two GitHub Actions workflows: a renamed/updated Review Queue workflow and a new PR Fixer workflow. The Review Queue changes are minimal and clean. The PR Fixer is well-structured with good authorization guards on the @ambient-fix comment path, but has three notable issues worth addressing before merge. Blocker Issues: None. Critical Issues 1. pull_request_target label trigger has no authorization check File: .github/workflows/pr-fixer.yml, lines 6-7 and fix-single job if condition (line 30) The pull_request_target trigger fires with full write-context secrets when the agent-managed label is added. The issue_comment path correctly guards authorization by checking author_association against MEMBER/OWNER/COLLABORATOR, but the labeled path has no equivalent check. Any GitHub user with Triage role can add the agent-managed label to any PR (including fork PRs) and trigger an authenticated ambient session spending org resources. Standard violated: security-standards.md - authorization check must be performed before resource access. Suggested fix: Add an actor check to the labeled branch of the if condition, or add a guard step that verifies the labeler has sufficient permissions before calling the ambient action. Major Issues 1. fix-each matrix missing fail-fast: false File: .github/workflows/pr-fixer.yml, strategy block in fix-each job GitHub matrix default is fail-fast: true, so if the ambient action fails for one PR, all other in-progress PR fix jobs are cancelled. For a batch maintenance workflow, each PR should be treated independently. Add fail-fast: false to the strategy block. 2. Python date-parse fallback silently expands batch scope File: .github/workflows/pr-fixer.yml, fix-batch step The Python script uses except Exception: active.append(pr['number']) when date parsing fails, meaning a PR with a malformed updatedAt is included in the batch rather than skipped, potentially triggering unexpected sessions. Log the parse failure and skip the PR instead. 3. Workflow-level permissions instead of job-level (least privilege) File: .github/workflows/pr-fixer.yml, lines 23-25 Permissions are declared at workflow level granting contents: read and pull-requests: read to all jobs. Only fix-batch needs pull-requests: read to call gh pr list. The fix-single and fix-each jobs use AMBIENT_BOT_TOKEN, not GITHUB_TOKEN. Move the permissions block to job level on fix-batch only. Standard violated: Least-privilege principle per security-standards.md. Minor Issues
Positive Highlights
Recommendations
Reviewed by Claude Code against .claude/context/security-standards.md, .claude/patterns/k8s-client-usage.md, and .claude/context/backend-development.md. |
pull_request_target runs in the base branch context which is a security concern. pull_request is sufficient since we only need the PR number to pass to the Ambient session. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/pr-fixer.yml:
- Around line 31-39: The workflow allows privileged runs (pull_request_target
and issue_comment flows) to act on forked PRs; update the conditional
expressions that gate the Ambient fixer (the pull_request_target and
issue_comment branches currently checking github.event_name and
github.event.issue.pull_request) to also verify the PR comes from the same
repository by requiring github.event.pull_request.head.repo.full_name ==
github.repository (or equivalent same-repo check) before passing the PR number
to privileged steps; apply the same same-repo guard to the other duplicated
condition blocks referenced in the diff so forked PRs cannot trigger the
privileged fixer.
- Around line 13-14: The workflow's schedule uses the cron entry '0 8,12,16,20 *
* 1-5' which creates a 12-hour overnight gap while the selector still only looks
back 4 hours; update the schedule cron to cover the overnight run (for example
change to '0 0,4,8,12,16,20 * * 1-5' or '0 0/4 * * 1-5') and/or increase the
selector lookback from 4 hours to at least 12 hours so no weekday PR activity is
missed (apply the same change to the second identical schedule block
referenced).
- Around line 98-132: The batch selector currently re-queues PRs updated by the
fixer itself (PRS/NEEDS_WORK) and never checks for an active fixer session (note
wait:'false'), so update the selection loop to skip PRs whose most-recent
activity was performed by the workflow actor and to skip PRs with an in-progress
fixer run: for each PR number in PRS, call gh pr view <num> (or gh api to fetch
timeline/last commit author) to obtain the last-updater identity and compare it
to the GITHUB_ACTOR/bot user and skip if they match, and also query recent
workflow runs/check-runs for the PR to detect an in-progress fixer session and
skip those PRs before adding them to NEEDS_WORK.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8289ca90-9d6d-41e6-89f7-bf2f9c214ccf
📒 Files selected for processing (2)
.github/workflows/pr-fixer.yml.github/workflows/pr-merge-review.yml
- Skip fork PRs on label trigger (check head.repo.fork) - Skip fork PRs on issue_comment trigger (gh pr view isCrossRepository) - Skip fork PRs in batch selector - Fix schedule gap: run every 4 hours including overnight (*/4) - Anti-churn: skip PRs whose last comment has <!-- pr-fixer-bot --> marker (prevents fixer from re-processing its own output) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🧪 CI InsightsHere's what we observed from your CI run for 0c49de6. 🟢 All jobs passed!But CI Insights is watching 👀 |
Summary
pr-merge-review.yml): renamed from "PR Merge Review", updated prompt for type classification and sub-agent evaluation, removed unusedSESSION_RESULTenv varpr-fixer.yml): new workflow with 4 triggers:agent-managedlabel added to a PR (immediate)@ambient-fixcomment from collaborator/member/owner (immediate)agent-managedPRs with recent activityworkflow_dispatchwith PR numberHow they work
agent-managedPRs updated in last 4h, spawns parallel sessions (fire-and-forget)Dependencies
Test plan
agent-managedlabel to a test PR and verify PR Fixer triggers@ambient-fixon a PR and verify it triggers🤖 Generated with Claude Code