fix(code): make codex-review run on current codex-cli (ISS-11082) - #207
Merged
Merged
Conversation
- Replace --full-auto, which codex-cli 0.154+ rejects with exit 2, with -c sandbox_mode=read-only in run_codex_review.sh. Both `codex exec` and `codex exec resume` accept it; -s does not work on resume. - Capture codex stderr instead of discarding it. CODEX_FAILED now carries one stderr line after the exit code, the full stderr goes to the script's stderr, and a failed resume names its cause. - Add test_run_codex_review.py, which runs the script against a fake codex that rejects flags the way codex-cli 0.154+ does. - Bump code plugin to 1.15.1. Testing: pytest test_run_codex_review.py (4 passed); real round 1 + resumed round 2 against codex-cli 0.158.0 returned verdicts; flag matrix probed on codex-cli 0.136.0 through 0.158.0. Risks: the reviewer now runs read-only instead of workspace-write. It only reads the plan and code; the script writes the feedback file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ISS-11082) - Add a codex-review test where codex exits 1 with only its 'Reading additional input from stdin...' banner on stderr, as it does when an API error arrives in the JSON stream. Testing: pytest test_run_codex_review.py (5 passed) Risks: None identified Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Read turn failures from codex's JSON stream first; codex writes them to stdout under --json, not to stderr. - Match stderr lines that start with 'error', so an ERROR tracing line is not reported as the cause; keep the last-line fallback. - Omit the empty parentheses when a failed resume has no reason. - Print the reason in debate-loop.sh with printf '%s', not echo -e. - Correct the removal version to codex-cli 0.147 (#36054). - Tests: resume fallback, one-line token, last-line fallback, anchored match, JSON-stream turn failure. Testing: pytest test_run_codex_review.py (8 passed) Risks: None identified Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mikeangstadt
approved these changes
Sep 29, 2026
mikeangstadt
left a comment
Collaborator
There was a problem hiding this comment.
Good fix, and the mutation table in the description is the kind of test evidence I wish every PR shipped with. Three non-blocking notes inline; the plan-review.sh one is the only one I'd consider pulling into this PR.
- plugin.json: main moved code to 1.16.3; this branch now bumps it to 1.16.4 (one PATCH bump over main) - CHANGELOG.md: keep main's code v1.16.3 to v1.15.1 entries; this branch's entry moves from v1.15.1 (now taken by main) to v1.16.4 at the top Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- run_codex_review.sh passes -c approval_policy=never. codex exec defaults approval to never but drops that default when the user's config sets approvals_reviewer = "auto_review" (exec/src/lib.rs build_exec_config at rust-v0.159.3). - run_codex_review.sh writes codex's stderr to its own stderr on both CODEX_EMPTY paths, as it already does for CODEX_FAILED. - hooks/plan-review.sh replaces --full-auto with -c sandbox_mode=read-only -c approval_policy=never and appends codex's stderr to its debug log instead of /dev/null. - Tests: approval pair on exec, resume and fallback calls; stderr on both CODEX_EMPTY paths; hook argv and hook stderr logging. Testing: pytest test_run_codex_review.py (12 passed); each new assertion fails when its code change is reverted. Real codex-cli 0.159.3 and 0.154.0 runs report approval: on-request with an auto_review config and approval: never with the new flag. Risks: None identified Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- CHANGELOG.md: keep main's code-review v3.10.3 entry below this branch's code v1.16.4 entry (newest-first) - plugin.json: code is still 1.16.3 on main, so this branch's 1.16.4 remains its single PATCH bump Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Fixes ISS-11082.
code:codex-reviewfailed on every round with a bareCODEX_FAILED:codex exited with code 2./plan-with-codexuses the same script, so it failed too.run_codex_review.shpassed--full-autotocodex execandcodex exec resume. codex-cli 0.147 removed that flag (Remove legacy--full-autohandling fromcodex execopenai/codex#36054), so codex now exits 2 witherror: unexpected argument '--full-auto' found.-c sandbox_mode=read-only -c approval_policy=never, which both subcommands accept.-s read-onlydoes not work here:codex exec resumerejects-s, so every resumed round would drop to a fresh session.--full-autoalso set approval to never.codex execdefaults to never, except when the user's config setsapprovals_reviewer = "auto_review", in which case the user'sapproval_policyapplies (codex-cli 0.159.3,codex-rs/exec/src/lib.rs:757-790). The explicit-c approval_policy=neverkeeps the old behavior: withauto_reviewandon-requestconfigured, exec and resume reportapproval: neveron 0.154.0 and 0.159.3./dev/null.CODEX_FAILEDnow ends with one line saying why codex failed, taken from the first of these that exists:turn.failedmessage in the--jsonstream (or, if none, the lasterrormessage), because codex writes turn failures to stdout;error, which covers clap and config errors;Reading ... from stdin...banner.CODEX_EMPTYpaths (exit 0 with no agent message). When a resume fails, the message now names the cause before the script falls back to a fresh session.plugins/code/hooks/plan-review.shgets the same change:codex exec -c sandbox_mode=read-only -c approval_policy=never, with stderr appended to the hook's debug log instead of/dev/null(review, Mike).debate-loop.shnow prints theCODEX_FAILEDreason withprintf '%s'instead ofecho -e. The reason is now codex's own text, andecho -eread the\cinC:\cacheas "stop output", which cut the message short.Compatibility
No version detection is needed. I probed every locally installed codex-cli build with
--help, and the sandbox argument works across the whole range. The-c approval_policy=neveroverride was probed on 0.154.0 and 0.159.3 only; it uses the same generic-ckey=value mechanism as the sandbox override.exec --full-autoexec -c sandbox_mode=read-onlyexec resume -c sandbox_mode=read-onlyexec resume -s read-onlyThe reviewer's sandbox is now read-only instead of
--full-auto's workspace-write. Nothing needs to write: Codex only reads the plan and the code, and the script writes the feedback file from the JSON stream. The callers (debate-loop.sh,plan-with-codex.md) matchCODEX_FAILED:*by prefix, so the longer reason does not break them.Versions
code1.16.3 -> 1.16.4Testing
plugins/code/tools/python/test_run_codex_review.pyruns the script against a fakecodexthat rejects flags the way codex-cli 0.147+ does, and runsplan-review.shagainst the same fake. All 12 tests pass atdbfe326. Review-round counterfactuals: dropping the approval flag fails the first-round, resume and fallback tests; dropping eitherCODEX_EMPTYstderr fails its case; restoring--full-autoor2>/dev/nullin the hook fails the hook tests.--full-autoCODEX_FAILED:codex exited with code 2: error: unexpected argument '--full-auto' found-s read-onlyassert 2 == 1, a silent fresh-session fallback; resume-fallback test: wrong cause2>/dev/nullerrormatch... ERROR codex_core::mcp ...tracing line-m1... try '--help'.WARNING: a noticeReading additional input from stdin...erroroverturn.failedReconnecting... 1/5Codex session resume failed, starting fresh session...gpt-6-astra.origin/main(ed495653) printsCODEX_FAILED:codex exited with code 2.2e01f2d, before the review round.CODEX_FAILED:codex exited with code 1: {"type":"error","status":400,...,"message":"The 'bogus-model-xyz' model is not supported when using Codex with a ChatGPT account."}}.codex exec -c sandbox_mode=read-onlydirectly reportssandbox: read-only, even though the user config setsworkspace-write.uv run ruff check .is clean.uv run pyrightreports 0 errors.uv run pytest plugins/at the final headdbfe326: 2191 passed, 3 skipped. CI atdbfe326is green.echo -ein the consumer, the empty(), and the fake codex's banner order.Follow-ups (not in this PR)
plugins/code/hooks/plan-review.shstill usesgpt-5.3-codex-spark, which codex rejects for ChatGPT-account auth (now visible in the hook's debug log). The hook is not registered inhooks.json, so nothing runs it today.--codex-model gpt-5.3-codexinrun_codex_review.shanddebate-loop.shis rejected for ChatGPT-account codex auth (The 'gpt-5.3-codex' model is not supported when using Codex with a ChatGPT account., found in this machine's~/.closedloop-ai/plan-with-codex/logs).🤖 Generated with Claude Code