Monitor and respond to automated PR reviews (Codex bot). Use when pushing a PR, checking review status, or responding to bot feedback. Handles the full cycle of push -> wait for review -> evaluate comments -> fix -> re-push.
This repo has chatgpt-codex-connector[bot] configured as an automated reviewer. After every push to a PR branch, Codex reviews the diff and either:
After pushing, check whether Codex has reviewed the latest commit:
# Get the latest commit SHA on the branch
LATEST=$(git rev-parse HEAD)
# Check if Codex has reviewed that specific commit
gh api repos/PrefectHQ/fastmcp/pulls/{PR_NUMBER}/reviews \
| jq "[.[] | select(.user.login == \"chatgpt-codex-connector[bot]\" and .commit_id == \"$LATEST\")] | length"
If the count is 0, Codex hasn't reviewed the latest push yet. Wait and check again.
If the count is > 0, check for inline comments on the latest review:
# Get the review body to check for thumbs-up
gh api repos/PrefectHQ/fastmcp/pulls/{PR_NUMBER}/reviews \
| jq '[.[] | select(.user.login == "chatgpt-codex-connector[bot]") | {state, body: .body[:300], commit_id: .commit_id}] | last'
A clean review from Codex looks like a review body that contains a thumbs-up reaction or says "no suggestions." If the body contains "Here are some automated review suggestions," there are inline comments to evaluate.
Fetch all inline comments from Codex:
gh api repos/PrefectHQ/fastmcp/pulls/{PR_NUMBER}/comments \
| jq '[.[] | select(.user.login == "chatgpt-codex-connector[bot]") | {body, path, line, created_at}]'
Codex comments include priority badges:
P0 (red) — Critical issue, likely a real bugP1 (orange) — Important, worth fixingP2 (yellow) — Moderate, evaluate on meritHow to evaluate Codex comments:
Treat Codex as a competent but sometimes overzealous reviewer. It catches real bugs (cache eviction ordering, silent data loss, missing validation) but also suggests scope expansions and hypothetical improvements.
Fix real bugs — issues in code you actually changed where behavior is incorrect or data is silently lost.
Dismiss scope expansion — if a comment points out a pre-existing limitation unrelated to your diff, note it as a potential follow-up but don't block the PR.
Dismiss speculative concerns — if a comment describes a scenario that requires very specific conditions and the existing behavior is acceptable, dismiss it.
When fixing, be proactive — if Codex found one instance of a pattern bug (e.g., missing role validation in one handler), check all similar code paths before pushing. Codex will find the next instance on the next review cycle, so get ahead of it.
Every Codex comment must get a visible response — either a fix or a reply explaining why it was dismissed. The maintainer can't see your reasoning otherwise.
Use gh api to reply (note: use in_reply_to, not a /replies sub-path):
# Reply to a specific review comment
gh api repos/PrefectHQ/fastmcp/pulls/{PR_NUMBER}/comments \
-f body="Your reply here" \
-F in_reply_to={COMMENT_ID}
After evaluating comments:
Codex sometimes re-posts old comments that reference code you've already fixed (they appear on the old commit's diff). These are stale — verify the fix is in the latest commit and reply noting the fix is already in place.
A PR is ready for human review when: