codex-review-loop
Codex review loop
Drive the GitHub Codex bot through repeated review-fix rounds on the current pull request: post @codex review, wait for the bot to finish, apply fixes for every actionable remark, push, and request another review. Repeat until Codex comes back with nothing actionable or you hit the iteration cap.
This is a closed loop you run mostly unattended. The work per round is: request → wait → read findings → fix → push → request again. The two things that make it reliable are (1) detecting precisely when this round's review has landed (not a stale one), and (2) waiting an amount of time that matches how long Codex actually takes rather than a fixed guess.
Prerequisites
Confirm these before starting; if one is missing, say so and stop rather than guessing.
ghis installed and authenticated (gh auth status).- The current branch has an open PR. Find it with
gh pr view --json number,url,headRefName,state. If there's no PR, offer to create one (gh pr create) — Codex reviews PRs, not bare branches. - The Codex GitHub app is installed on the repo. You can't verify this directly; if no review ever appears after a request, surface that the app may not be installed/enabled rather than looping forever.
How a Codex review behaves (so you can detect it)
Knowing the bot's mechanics is what lets you wait correctly instead of sleeping blindly: