Problem
/codex:adversarial-review fails on large diffs (~16 files, 660 lines) in two ways:
spawnSync invoking git diff in scripts/lib/process.mjs has no maxBuffer — crashes with ENOBUFS on diffs >1MB
- Even with
maxBuffer patched locally, the assembled prompt exceeds the Codex API's 1048576 character input limit
Both failures happen because collectReviewContext() collects the full git diff output via spawnSync, and the adversarial review embeds it in the prompt sent via turn/start.
Why this doesn't affect /codex:review
The native review uses review/start with a target reference ({ type: "uncommittedChanges" }), so Codex collects the diff internally. The companion script never touches the diff content.
Suggested fix
Instead of embedding the diff in the prompt, have the adversarial review prompt instruct Codex to run git diff (or similar) itself to collect the changes for review. The Codex CLI would need to be executed with settings that allow running read-only git commands (e.g. appropriate sandbox permissions).
This would eliminate both the Node buffer limit and the API input limit, since the diff never flows through the companion script.
Repro
Any repo with >1MB of uncommitted/staged changes:
/codex:adversarial-review --wait
Step 1 error: spawnSync git ENOBUFS
After patching maxBuffer: Input exceeds the maximum length of 1048576 characters.
Environment
- codex-plugin-cc: 1.0.0
- codex CLI: 0.117.0
- Node.js: v22
- macOS arm64
Problem
/codex:adversarial-reviewfails on large diffs (~16 files, 660 lines) in two ways:spawnSyncinvokinggit diffinscripts/lib/process.mjshas nomaxBuffer— crashes withENOBUFSon diffs >1MBmaxBufferpatched locally, the assembled prompt exceeds the Codex API's 1048576 character input limitBoth failures happen because
collectReviewContext()collects the fullgit diffoutput viaspawnSync, and the adversarial review embeds it in the prompt sent viaturn/start.Why this doesn't affect
/codex:reviewThe native review uses
review/startwith a target reference ({ type: "uncommittedChanges" }), so Codex collects the diff internally. The companion script never touches the diff content.Suggested fix
Instead of embedding the diff in the prompt, have the adversarial review prompt instruct Codex to run
git diff(or similar) itself to collect the changes for review. The Codex CLI would need to be executed with settings that allow running read-only git commands (e.g. appropriate sandbox permissions).This would eliminate both the Node buffer limit and the API input limit, since the diff never flows through the companion script.
Repro
Any repo with >1MB of uncommitted/staged changes:
Step 1 error:
spawnSync git ENOBUFSAfter patching maxBuffer:
Input exceeds the maximum length of 1048576 characters.Environment