Repository navigation
fix(dev-lead): post Add enable-auto-merge intent for bot approvals resolve on no-changes + enable auto-merge on approval - #297
Conversation
…-merge on approval Two gaps in the PR review lifecycle: 1. notify_coderabbit_resolve was only called when the agent pushed code changes. When the agent ran but made no changes (e.g. CodeRabbit flagged a file outside the PR diff), CodeRabbit never got the resolve signal and CHANGES_REQUESTED persisted indefinitely. Now called in both branches for fix-reviews, fix-bot-comment, and human-pr. 2. PRs were never marked for auto-merge even after reaching full approval. Added try_enable_auto_merge() called at the end of all three intent completion paths, and a new enable-auto-merge intent triggered when any trusted bot approves. The bot-approval path skips engine install (gh CLI only, no LLM). Root cause of PR #80 delay: CodeRabbit's CHANGES_REQUESTED on 2026-05-17 was on claude.yml (outside the PR diff). The fix-reviews run made no changes and never posted @coderabbitai resolve, leaving the PR in CHANGES_REQUESTED for 3 days. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ 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)
📝 WalkthroughWalkthroughThis PR adds an ChangesEnable auto-merge on bot-approved reviews
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Dev-Lead — human-pr (no-changes)No changes were needed for this PR. |
Dev-Lead — fix-bot-comment (no-changes)Engine ran but made no changes. |
1 similar comment
Dev-Lead — fix-bot-comment (no-changes)Engine ran but made no changes. |
There was a problem hiding this comment.
Pull request overview
This PR improves the dev-lead automation flow by (1) ensuring CodeRabbit can be unblocked even when the agent makes no code changes and (2) enabling GitHub auto-merge once a PR is fully approved, including a lightweight path triggered by trusted bot approvals.
Changes:
- Always call
notify_coderabbit_resolvein both “changes” and “no-changes” branches for review-fixing intents. - Add
try_enable_auto_merge()and a newenable-auto-mergeintent to enable squash auto-merge whenreviewDecisionisAPPROVED. - Update/add unit tests and fixtures for the new routing and behaviors.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/dev-lead-intent.sh |
Routes trusted-bot APPROVED reviews to the new enable-auto-merge intent. |
scripts/dev-lead-fix-reviews.sh |
Adds try_enable_auto_merge() and calls CodeRabbit resolve + auto-merge logic in no-change paths. |
.github/workflows/dev-lead.yml |
Skips engine install/preflight for enable-auto-merge and adds an inline auto-merge enablement step. |
tests/dev-lead/unit/test_intent_reviews.bats |
Updates expected intent for bot approvals; adds CodeRabbit-approved routing test. |
tests/dev-lead/unit/test_intent_ci.bats |
Updates expected intent for copilot approval in CI intent tests. |
tests/dev-lead/unit/test_fix_reviews.bats |
Adds dry-run tests for CodeRabbit resolve on no-changes and auto-merge attempts. |
tests/dev-lead/fixtures/events/pr_review_coderabbit_approved.json |
Adds a fixture for CodeRabbit bot approval webhook payload. |
Comments suppressed due to low confidence (1)
tests/dev-lead/unit/test_fix_reviews.bats:417
- These auto-merge dry-run assertions are also too weak because they allow any "[dry-run]" output, which is emitted by other parts of the script. Tighten the checks to look for the specific try_enable_auto_merge message (e.g., "would enable auto-merge") so failures can’t slip through unnoticed.
@test "fix-reviews: try_enable_auto_merge dry-run output present for fix-reviews" {
export INTENT_TYPE="fix-reviews"
export DEV_LEAD_DRY_RUN="true"
run bash "$FIX_REVIEWS_SCRIPT"
[ "$status" -eq 0 ]
[[ "$output" == *"auto-merge"* || "$output" == *"[dry-run]"* ]]
}
@test "fix-reviews: try_enable_auto_merge dry-run output present for fix-bot-comment" {
export INTENT_TYPE="fix-bot-comment"
export DEV_LEAD_DRY_RUN="true"
export COMMENT_BODY="SonarQube found issues"
run bash "$FIX_REVIEWS_SCRIPT"
[ "$status" -eq 0 ]
[[ "$output" == *"auto-merge"* || "$output" == *"[dry-run]"* ]]
}
@test "fix-reviews: try_enable_auto_merge dry-run output present for human-pr" {
export INTENT_TYPE="human-pr"
export DEV_LEAD_DRY_RUN="true"
export PR_TITLE="Test PR"
export PR_DESCRIPTION="A test pull request"
run bash "$FIX_REVIEWS_SCRIPT"
[ "$status" -eq 0 ]
[[ "$output" == *"auto-merge"* || "$output" == *"[dry-run]"* ]]
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request implements automatic auto-merge (squash) functionality for pull requests. Key changes include the addition of a try_enable_auto_merge function in dev-lead-fix-reviews.sh that utilizes the GitHub CLI to enable auto-merge on approved PRs, and updates to dev-lead-intent.sh to emit an enable-auto-merge intent when trusted bots approve a PR. The PR also ensures notify_coderabbit_resolve is called in no-change scenarios and adds corresponding unit tests and fixtures. I have no feedback to provide.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e4b5f8395
ℹ️ 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".
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
Dev-Lead — human-pr (applied)Changes committed and pushed. |
Dev-Lead — fix-bot-comment (no-changes)Engine ran but made no changes. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48d1c58e72
ℹ️ 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".
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
Dev-Lead — human-pr (no-changes)No changes were needed for this PR. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 955e4f811a
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/dev-lead-reusable.yml:
- Around line 247-257: The workflow step "Enable auto-merge on bot approval" was
added directly to the workflow instead of using the approved template; revert
this direct step and implement the change inside the canonical template under
standards/workflows/ so the workflow remains verbatim. Specifically, remove the
added step that uses env.INTENT_TYPE checks, PR_NUMBER/HEAD_SHA envs and the run
of .dev-lead/scripts/dev-lead-fix-reviews.sh from this file, then add or update
the corresponding template file in standards/workflows/ to include that behavior
(or reference an existing template) so the repository workflow pulls from the
template verbatim; ensure the step name "Enable auto-merge on bot approval" and
the script invocation remain in the template rather than in this workflow file.
In @.github/workflows/dev-lead.yml:
- Around line 224-235: The workflow file was modified directly (the "Enable
auto-merge on bot approval" job and its env vars like INTENT_TYPE, PR_NUMBER,
HEAD_SHA and the run step invoking scripts/dev-lead-fix-reviews.sh) which
violates the rule that workflows must be sourced verbatim from
standards/workflows/; revert this direct change and instead apply the same
change to the canonical template in standards/workflows/ (or update the
template-import mechanism used by your CI) so the workflow file is regenerated
from that template, ensuring the job "Enable auto-merge on bot approval" and its
environment variables and run step are defined only in the canonical template
rather than edited in-place.
In `@scripts/dev-lead-fix-reviews.sh`:
- Around line 156-162: Replace the Bash-only array merge_args with a POSIX-safe
positional-parameter assembly: use set -- --auto --squash to initialise the
arguments, conditionally append the head match with [ -n "${HEAD_SHA:-}" ] &&
set -- "$@" --match-head-commit "$HEAD_SHA", then call gh pr merge "$PR_NUMBER"
--repo "$REPO" "$@" (and keep the strict branch and fallback warning logic
intact); update references to merge_args, HEAD_SHA, PR_NUMBER, REPO and the gh
pr merge invocation accordingly so the script works in POSIX sh.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: f32c1f46-ee0e-4b03-81d7-5dc6a166dc53
📒 Files selected for processing (8)
.github/workflows/dev-lead-reusable.yml.github/workflows/dev-lead.ymlscripts/dev-lead-fix-reviews.shscripts/dev-lead-intent.shtests/dev-lead/fixtures/events/pr_review_coderabbit_approved.jsontests/dev-lead/unit/test_fix_reviews.batstests/dev-lead/unit/test_intent_ci.batstests/dev-lead/unit/test_intent_reviews.bats
…rge args Two fixes in try_enable_auto_merge: 1. HEAD_SHA refresh: commit_and_push may create a new commit after HEAD_SHA is resolved at script startup. Without refreshing, --match-head-commit uses a stale SHA and the gh pr merge call fails silently (downgraded to a warning in non-strict mode), so auto-merge never activates on the "applied changes" path. Fix: git rev-parse HEAD at function entry. 2. POSIX-safe merge args: replaced bash-only array (merge_args+= syntax) with positional-parameter assembly via set -- so the merge call works in any POSIX-compatible shell. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Addressing CodeRabbit's review comments: Fixed (2 legitimate issues):
Resolved as false positives (2 template-rule threads): |
|



Summary
@coderabbitai resolvein no-changes path:notify_coderabbit_resolvewas only called when the agent pushed code changes. When the agent made no changes (e.g. CodeRabbit flagged a file outside the PR diff), CodeRabbit's CHANGES_REQUESTED persisted indefinitely. Now called in both branches forfix-reviews,fix-bot-comment, andhuman-pr.try_enable_auto_merge()called at the end of all three intent completion paths. Added a newenable-auto-mergeintent emitted when any trusted bot approves — this lightweight path skips engine install (uses only theghCLI, no LLM) and enables auto-merge if the PR'sreviewDecisionisAPPROVED.claude.yml, a file outside the PR diff. The fix-reviews run found no open threads to address, made no changes, and never posted@coderabbitai resolve— leaving the PR in CHANGES_REQUESTED for 3 days until unrelated activity triggered CodeRabbit to re-review.Files changed
scripts/dev-lead-intent.shbot-approvedskip →enable-auto-mergeintentscripts/dev-lead-fix-reviews.shtry_enable_auto_merge(); callnotify_coderabbit_resolvein no-changes branches.github/workflows/dev-lead.ymlenable-auto-mergestep; skip pre-flight/engine install for that intenttests/dev-lead/unit/test_intent_reviews.batstests/dev-lead/unit/test_intent_ci.batstests/dev-lead/unit/test_fix_reviews.batstests/dev-lead/fixtures/events/pr_review_coderabbit_approved.jsonTest plan
@coderabbitai resolveis posted🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores