fix(ci): stop AI PR Review from failing a successful review - #17
Conversation
The review comment and pass label are posted before the approval call, so a dead AI_REVIEW_APPROVER_TOKEN was turning a completed review into a red check. Degrade to "reviewed, not approved" and surface the HTTP code in the step summary instead of raising.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64afd41cb8
ℹ️ 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".
| f"Review posted, but auto-approve failed " | ||
| f"(HTTP {e.code}). {hint}" | ||
| ) | ||
| except urllib.error.URLError as e: |
There was a problem hiding this comment.
Treat approval timeouts as non-fatal
When GitHub's approval request reaches the 30-second timeout, urllib.request.urlopen can raise TimeoutError, which is not a subclass of urllib.error.URLError. In that transient network scenario, the exception still escapes after the comment and label were posted, leaving the successful review as a failed workflow—the behavior this change is intended to prevent. Catch TimeoutError alongside URLError, as the Anthropic request path already does.
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
AI PR Review has failed 26 times across 4 repos in the last 72h while the review itself succeeded every time. Two independent causes, both in the wrap-up after the review is already posted:
ai_pr_review.py): the auto-approve POST returns401 Unauthorized(AI_REVIEW_APPROVER_TOKENexpired or under-scoped) and raises, after the review comment and pass label have already landed. Now caught: the run degrades to "reviewed, not approved" and prints the HTTP code and likely cause in the step summary.ai-pr-review-v2.yml):--max-turns 15is below what a real review costs —gh pr diff+ per-file reads + one inline comment per finding. ObservedClaude reported a successful result after 18 turnsanderror_max_turns(nostructured_output) on a 3-file PR. Raised to 40; spend is bounded by the daily USD cap, not by this number.Applied identically across all 16 repos carrying these workflows (v1 script sha was
d7a86c89everywhere, v2 workflow sha4f88ddb9everywhere).Note: the 401 itself is a separate follow-up — the approver PAT still needs rotating for auto-approve to resume.