GH-4520: fix(autopilot): remove vestigial AutoReview self-approve — guaranteed 422 API call on every merge#4522
Merged
Merged
Conversation
MergePR submitted an APPROVE review on PRs authored by the daemon's own token, which GitHub always rejects with 422 (bot can't approve its own PR). Approval is already obtained upstream via handleAwaitApproval before MergePR runs, so the call was pure dead weight — one guaranteed-fail API call against the shared rate-limit pool on every merge.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Automated PR created by Pilot for task GH-4520.
Closes #4520
Changes
GitHub Issue GH-4520: fix(autopilot): remove vestigial AutoReview self-approve — guaranteed 422 API call on every merge
Context
Every auto-merge logs
auto-review failed … 422 "Review Can not approve your own pull request"(seen on pilot PRs 4514/4515/4516/4518 and console PR 30 on 2026-07-23 alone). The daemon tries to submit an APPROVE review on a PR authored by its own token — GitHub always rejects this with 422.Root cause (ground truth @ main)
internal/autopilot/types.go:103-104—AutoReview boolconfig field;:424defaults it totrue.internal/autopilot/auto_merger.go:62-67—MergePRcallsapprovePRwhenAutoReviewis set; the error is swallowed as a WARN and merge proceeds.auto_merger.go:51states approval is obtained upstream by the controller'shandleAwaitApprovalbeforeMergePRis called — the auto-review is vestigial. Net effect: one guaranteed-fail GitHub API call per merged PR on the shared 5000/hr user pool.Required changes
AutoReviewconfig field, its default, and theapprovePRcall path inMergePR(includingapprovePRitself if nothing else references it).auto_review:without erroring (lax YAML decode already handles unknown keys — verify).Acceptance criteria
MergePRperforms no review-submission API call.auto_review: truestill loads (ignored, no error).Scope
internal/autopilot/types.go,internal/autopilot/auto_merger.go+ tests. No behavior change to the approval-gate flow (handleAwaitApproval).