Skip to content

feat(review): add codex-reviewer agent for cross-model validation#352

Closed
mvanhorn wants to merge 1 commit intoEveryInc:mainfrom
mvanhorn:feat/codex-reviewer-agent
Closed

feat(review): add codex-reviewer agent for cross-model validation#352
mvanhorn wants to merge 1 commit intoEveryInc:mainfrom
mvanhorn:feat/codex-reviewer-agent

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

Summary

Adds a review agent that delegates to codex review for an independent second opinion during ce:review. Users opt in by adding codex-reviewer to their review_agents list in compound-engineering.local.md.

Why

Users are manually running codex review in separate terminals and merging the results themselves. @JamesHenry in #34: "I've found myself frequently manually invoking codex to check work. Having it native to this plugin flow would be great."

PR #328 added Codex delegation for code writing via ce:work-beta. This extends the pattern to the review side.

Changes

One new file: plugins/compound-engineering/agents/review/codex-reviewer.md (81 lines)

The agent:

  1. Guards against running inside Codex sandbox (CODEX_SANDBOX/CODEX_SESSION_ID env vars)
  2. Checks codex CLI availability, skips with install instructions if missing
  3. Resolves the base branch from PR context or git remote HEAD
  4. Runs codex review --base $BRANCH using the user's own configured model (no hardcoded model - respects ~/.codex/config.toml)
  5. Formats output for ce:review synthesis

Also adds the agent to the README review agents table.

Design notes

Follows @tmchow's feedback from #328:

  • No hardcoded model (-m flag omitted, uses codex default)
  • Environment detection guard before attempting delegation
  • Opt-in via existing review_agents config, not forced on all users

Uses codex review (the purpose-built review subcommand) rather than codex exec with piped diffs as proposed in #34. The dedicated subcommand handles diff extraction, file context, and structured output internally.

Testing

  • bun run release:validate passes (30 agents, 42 skills, 1 MCP server)
  • Ran codex review --base main on this branch's diff - it read the changes, inspected surrounding agent files, and produced a structured review
  • Environment guard verified: CODEX_SANDBOX and CODEX_SESSION_ID are unset in Claude Code, set inside Codex sandbox

Partially addresses #34

This contribution was developed with AI assistance (Claude Code).

Add a review agent that delegates to OpenAI's Codex CLI (`codex review`)
to provide cross-model code review validation. The agent:

- Guards against running inside Codex sandbox (CODEX_SANDBOX/CODEX_SESSION_ID)
- Detects codex CLI availability and skips gracefully if not installed
- Resolves the base branch from PR context or git remote HEAD
- Runs `codex review --base $BRANCH` using the user's configured model
- Formats output for the ce:review synthesis pipeline
- Opt-in via compound-engineering.local.md review_agents list

Does not hardcode a model - delegates to codex's own config.

Partially addresses EveryInc#34

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca49e8c8ed

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

```bash
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'
```
3. Fall back to `main`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle master repos in base-branch fallback

The final fallback hardcodes main, which breaks this reviewer in repositories that still default to master (a case the plugin supports elsewhere) when refs/remotes/origin/HEAD is missing. In that scenario BASE_BRANCH becomes a non-existent ref, so codex review --base "$BASE_BRANCH" fails and the agent always returns FAILED instead of producing review output. Add a master fallback (or detect an existing default branch) before defaulting.

Useful? React with 👍 / 👎.

@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 23, 2026

@mvanhorn take a look at #348 . I really want us to move to that new review agent as I think it's better is every way in my testing. We need to bang on it more but would love to see you base this PR on that (or have this PR update both ce:review and ce:review-beta)

@mvanhorn
Copy link
Copy Markdown
Contributor Author

Checked out #348 - the structured pipeline with confidence calibration is a much better home for a cross-model reviewer than the old free-form dispatch. Makes sense to build on that.

I'll close this and open a new PR against the review-beta branch that adds the codex-reviewer as a pipeline stage. Should slot in cleanly as stage 5 or 6 since it's doing independent validation.

1 similar comment
@mvanhorn
Copy link
Copy Markdown
Contributor Author

Checked out #348 - the structured pipeline with confidence calibration is a much better home for a cross-model reviewer than the old free-form dispatch. Makes sense to build on that.

I'll close this and open a new PR against the review-beta branch that adds the codex-reviewer as a pipeline stage. Should slot in cleanly as stage 5 or 6 since it's doing independent validation.

@mvanhorn mvanhorn closed this Mar 24, 2026
mvanhorn added a commit to mvanhorn/compound-engineering-plugin that referenced this pull request Mar 24, 2026
Adds a codex-reviewer persona agent that delegates to the Codex CLI
for cross-model validation, then translates findings into the
structured JSON schema used by the review-beta pipeline. Gracefully
degrades when codex is unavailable.

- New agent: agents/review/codex-reviewer.md
- Added to persona-catalog.md as conditional cross-model reviewer
- Added to SKILL.md conditional reviewers table
- Updated persona count from 8 to 9

Addresses feedback from EveryInc#352.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mvanhorn added a commit to mvanhorn/compound-engineering-plugin that referenced this pull request Mar 24, 2026
Adds a codex-reviewer persona agent that delegates to the Codex CLI
for cross-model validation, then translates findings into the
structured JSON schema used by the review-beta pipeline. Gracefully
degrades when codex is unavailable.

- New agent: agents/review/codex-reviewer.md
- Added to persona-catalog.md as conditional cross-model reviewer
- Added to SKILL.md conditional reviewers table
- Updated persona count from 8 to 9

Addresses feedback from EveryInc#352.

Co-Authored-By: Claude Opus 4.6 <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.

2 participants