Skip to content

adversarial-review crashes on large diffs (ENOBUFS / input limit exceeded) #11

@yuvalwiz

Description

@yuvalwiz

Problem

/codex:adversarial-review fails on large diffs (~16 files, 660 lines) in two ways:

  1. spawnSync invoking git diff in scripts/lib/process.mjs has no maxBuffer — crashes with ENOBUFS on diffs >1MB
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions