Skip to content

fix: raise adversarial review inline diff limits and expose overrides#327

Open
kingdoooo wants to merge 1 commit into
openai:mainfrom
kingdoooo:fix/adversarial-review-inline-limits
Open

fix: raise adversarial review inline diff limits and expose overrides#327
kingdoooo wants to merge 1 commit into
openai:mainfrom
kingdoooo:fix/adversarial-review-inline-limits

Conversation

@kingdoooo
Copy link
Copy Markdown

Summary

/codex:adversarial-review fails on normal-sized PRs (e.g. 10 files / 318KB) with Missing string verdict. Root cause is a contract conflict in the self-collect path:

  • git.mjs:8-9 caps inline diff at 2 files / 256KB (defaults from early-2024)
  • Above the cap, git.mjs:331 switches to the lightweight self-collect prompt that tells Codex "Inspect the target diff yourself with read-only git commands"
  • But the same turn at codex-companion.mjs:411-412 enforces sandbox: "read-only" + outputSchema: review-output.schema.json and exposes no shell tool
  • Codex tries to emit a shell-call JSON (e.g. {"cmd": "git status"}), the schema validator rejects it because verdict is missing, and the run fails

This PR makes the contradictory self-collect path rarely reachable in practice and gives users an escape hatch when they do hit it:

  • Raise defaults to 50 files / 1 MB in git.mjs. A 1MB diff is roughly 250K tokens, well within current GPT-5 context, and 50 files covers the long tail of real PRs.
  • Add --max-inline-files <n> and --max-inline-bytes <n> to /codex:adversarial-review. 0 forces the self-collect prompt for debugging or unusually large diffs that would blow the context window.

The deeper structural fix (multi-turn + shell tool when going self-collect, or relaxing outputSchema on that branch) is left out of scope — this PR focuses on the practical regression so the command works on normal-sized PRs again.

Out of scope

  • /codex:review (native reviewer via runAppServerReview) is unaffected — different code path.
  • The self-collect prompt + JSON-only output schema mismatch is preserved as a fallback. Worth a separate issue/PR if anyone hits diffs above 1MB.

Testing

node --test tests/git.test.mjs tests/runtime.test.mjs tests/commands.test.mjs

New tests:

  • collectReviewContext keeps inline diffs for medium-sized adversarial reviews under default limits (11-file diff, default caps → inline-diff)
  • collectReviewContext respects maxInlineFiles override forcing self-collect
  • adversarial review keeps medium-sized diffs inline under default limits (CLI integration)
  • adversarial review --max-inline-bytes forces self-collect on large diffs (CLI integration)
  • adversarial review rejects negative --max-inline-files (input validation)

Existing self-collect tests now pass maxInlineFiles: 2 (or --max-inline-files 2) explicitly so they continue to exercise the self-collect path under the higher defaults.

Note: 3 unrelated tests (status shows phases, status preserves adversarial review kind labels, result returns the stored output...) fail on my macOS sandbox both before and after this change. They appear environment-specific and were not introduced by this PR.

Default inline-diff caps (2 files / 256KB) were tuned for early-2024
context windows and caused /codex:adversarial-review to fail on
normal-sized PRs. The self-collect path tells Codex to read the diff
itself with git commands, but the same turn enforces outputSchema with
sandbox: read-only and no shell tool exposed, so Codex emits a tool-call
JSON that fails schema validation.

Raise defaults to 50 files / 1 MB so the contradictory self-collect
path is rarely reached in practice, and add --max-inline-files /
--max-inline-bytes overrides on /codex:adversarial-review for users who
hit edge cases or want to force the lightweight prompt for debugging.
@kingdoooo kingdoooo requested a review from a team May 17, 2026 09:58
fireblue added a commit to fireblue/codex-plugin-cc that referenced this pull request May 17, 2026
…penai#255, openai#165, openai#253, openai#209, openai#239, openai#307, openai#315)

- Raise adversarial review inline diff limits to 50 files / 1MB (openai#327)
- Add wall-clock timeouts to JSON-RPC requests (openai#302)
- Use codex-namespaced clientInfo.name (openai#200, openai#255)
- Handle EAGAIN in hook scripts for non-blocking stdin (openai#165)
- Replace Node.js SessionStart hook with faster bash script (openai#253)
- Add --fast flag for service_tier support (openai#209)
- Set timeout: 600000 on foreground review/adversarial-review flows (openai#239)
- Rename gpt-5-4-prompting skill to codex-prompting (openai#307)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant