Since May I've been building Endurance, my own AI agent harness. It runs on a small server at home, I give it instructions through Telegram, and it writes most of its own code. I run my day job through it too. Every pull request it opens gets reviewed by another model before it merges.
For the first six weeks that reviewer was a panel of Claude agents. In June I moved review to OpenAI's Codex. Codex has now run over 1,500 reviews, and the biggest difference didn't come from the switch itself. It came from how I prompt it.
Why I switched
The honest reason was rate limits. Each review spun up about ten Claude agents at once, five to find issues and several more to score them, and it was the main reason I kept hitting Anthropic's server-side limits. Codex runs on a different provider, so moving review there took that load away completely.
The better reason came afterwards. A model from a different company doesn't share the blind spots of the one that wrote the code. Claude writes most of the PRs and Codex reviews them. When Codex writes one, Claude reviews it. If Codex runs out of quota, Claude steps in as the reviewer and the summary says so, because a review from the same model as the author is weaker evidence.
Codex's review of the PR that made the switch found a problem in it. My new rules said risky PRs needed two Codex passes, but the overnight loop still marked a PR ready after one.
A prompt written for the repo
I could have run a bare codex review and got generic feedback. Instead the switch came with a review prompt written for this repo. It has four parts.
The danger surfaces. It names the code where a bug hurts most: the approval flow, the code that drives each turn, the permission rules, database migrations, and any new tool the agent gets. For the permission rules it asks for both directions, a dangerous command that slips through and a harmless one that gets blocked. My last article is about why that matters.
- Profile allowedTools / denyPatterns / confirmPatterns (src/profiles/*) —
the permission boundary. A loosened or mis-scoped pattern is a SECURITY
finding. These patterns match against the WHOLE bash command string:
check BOTH directions — a dangerous command that slips the gate
(false-negative) AND a benign command that gets wrongly gated
(false-positive).
Repo footguns. Things that only bite in this codebase. Model names are plain strings, so a wrong one fails at runtime, not at build. The agent runs inside the service it can restart, so a deploy kills the turn that triggered it. The shell is zsh, not bash.
What to ignore. Lint, formatting and type errors (CI catches those), style nitpicks, and problems on lines the PR didn't touch.
The output format. Every finding needs a file and line, a confidence score from 0 to 100, what breaks, a concrete failure scenario and a fix. Anything at 75 or above blocks the merge.
OUTPUT — for each finding:
- file:line — exact location.
- confidence (0-100): 75+ means you verified it's real and will bite in
practice (blocking). Below 75 means plausible — state what would confirm.
- severity: what breaks (outage / data-loss / security / wrong-behavior /
cleanup).
- failure_scenario: the concrete inputs/state that trigger it and the wrong
result.
- fix: the specific change.
The failure scenario is the most useful part. It makes the reviewer say which input causes which wrong result, so a vague finding is easy to spot and dismiss.
A few things it caught with that prompt:
- The agent tightened its own rule against recursive deletes, and the new version let
rm -rf /tmp /andrm -rf ~/work ~straight through. - API tokens in recorded commands would have been stored permanently, where other tools could read them.
- Every turn that ran on Codex was missing from my spend reports, and runs that couldn't be measured were counted as $0.
- The vulnerability scanner turned a crash into "all clear" and wiped the vulnerabilities it already knew about.
None of these were style problems. They would all have gone wrong quietly in production.
A PR could weaken its own review
In July I turned the review process into a skill that my interactive sessions and the overnight loop both use. Codex reviewed that PR and found the worst hole so far. The skill read the review checklist from the PR's own branch. A PR could delete checks from the checklist, then get reviewed against the weaker copy and approved overnight.
The fix took minutes. The checklist is now always read from main, so a PR can't change the rules it's reviewed against. Any PR that touches the review process also waits for me, even if it only changes docs.
Codex has no memory between rounds
A risky PR usually takes a few rounds. Codex finds issues, the agent fixes them, and Codex reviews again. Each round is a fresh Codex session, so anything that isn't in the prompt didn't happen.
The first version carried one thing between rounds: a ledger of findings I'd declined, so they weren't raised again. That wasn't enough. On one PR in August, rounds 3, 4 and 5 each found the same bug in a different file. A rule was stated in one file and not in the files that relied on it, and each high-effort round found one more instance.
Now every round after the first gets three things:
- what's been fixed so far, so it can check the fix is complete instead of rediscovering it
- what I've declined and why, with the file it applied to
- the recurring shape, once two findings share a root cause, with an instruction to list every instance in one finding
The next pass found all the remaining instances at once. Same model, same effort. I only changed the instruction.
The PR that added this had the same kind of bug. It told the Codex-authored path to pass round context to Claude, but the script that calls Claude had no way to accept it. Codex caught that as well.
Where it went wrong
My first prompt said "a missed bug ships; a false positive costs me 30 seconds". That was true for a single review. At this volume a false positive costs a whole high-effort round, and one PR went through 13 rounds of small findings before it was clean. The prompt already told Codex not to pad with nitpicks. What actually fixed it was the ledger and the round context, so each round only reports what's new.
Codex is sometimes wrong. It flagged an SSH setting as a security risk, and a quick test proved it wasn't. Sometimes it's right and I accept the risk anyway. It pointed out that the tool the agent uses to file GitHub issues could be used to leak data. The repo is private, so I recorded the decision and moved on.
The review process was also too heavy at first. In one day, five of seven PRs went to the top tier, one of them a single docs file. The extra security-focused pass on risky PRs kept returning nothing on prose and simple migrations. Now how hard a PR gets reviewed is decided separately from who's allowed to merge it, and the security pass only runs when there's a security reason: permissions, network access, auth or a new tool.
The numbers
Between June and November Codex ran 1,538 review sessions on Endurance, 1,275 of them at high effort. 448 came back clean. The rest raised 1,695 findings, 509 of them P1. Re-runs repeat findings, so the number of distinct issues is lower.
If you want to try this
- Review with a different model from the one that wrote the code.
- Write a review prompt for your repo: the risky files, the footguns, and what to ignore.
- Ask for a confidence score and a concrete failure scenario on every finding.
- Read the review rules from main, never from the branch being reviewed.
- Tell each round what was fixed, what was declined and what keeps coming up.
How are you reviewing AI-written code?

Top comments (0)