Skip to content

second-opinion: switch Codex from codex review to codex exec#93

Merged
dguido merged 4 commits intomainfrom
codex-exec-structured-output
Feb 17, 2026
Merged

second-opinion: switch Codex from codex review to codex exec#93
dguido merged 4 commits intomainfrom
codex-exec-structured-output

Conversation

@dguido
Copy link
Copy Markdown
Member

@dguido dguido commented Feb 17, 2026

Summary

  • Switch from codex review to codex exec with --output-schema and -o (output-last-message) to eliminate context waste from verbose [thinking] and [exec] blocks
  • Add structured JSON output schema for review findings with typed fields (title, body, priority, confidence, file location)
  • Use OpenAI's published code review prompt that GPT-5.2-codex was specifically trained on
  • Lower default reasoning effort from xhigh to high for faster reviews
  • Remove the --base/--commit prompt limitation — all scopes now support project context and focus instructions
  • Include untracked files in uncommitted scope using git diff --no-index
  • Use mktemp instead of hardcoded /tmp/ paths for portability
  • Capture stderr to a log file instead of /dev/null for faster error diagnosis

Test plan

  • Run /second-opinion with Codex on uncommitted changes (including new untracked files) and verify findings appear as structured JSON
  • Run /second-opinion with Codex on a branch diff with project context and verify the review prompt includes CLAUDE.md contents
  • Run /second-opinion with both tools and verify parallel execution still works
  • Verify codex exec output file contains valid JSON matching the schema
  • Verify stderr log captures errors when Codex fails (e.g., wrong model name)

🤖 Generated with Claude Code

dguido and others added 4 commits February 17, 2026 02:42
Use codex exec with --output-schema and -o (--output-last-message)
instead of codex review. This eliminates context waste from verbose
[thinking] and [exec] blocks by capturing only the structured JSON
review output to a file. Uses OpenAI's published code review prompt
that GPT-5.2-codex was specifically trained on.

Also lowers default reasoning from xhigh to high, removes the
--base/--commit prompt limitation (all scopes now support project
context and focus instructions), and adds a JSON schema for
structured findings output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Include untracked files in uncommitted scope diff using
  git ls-files + git diff --no-index, matching the coverage
  that codex review --uncommitted previously provided
- Replace hardcoded /tmp/ paths with mktemp for portability
- Rename absolute_file_path to file_path in schema since
  git diff produces relative paths
- Capture stderr to a log file instead of /dev/null for
  faster error diagnosis without retry

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add required and additionalProperties: false to JSON schema
- Use -o (short flag) consistently; clarify --output-last-message
- Add cookbook citation URL for the code review prompt
- Add || true to git diff --no-index (exits 1 on diff found)
- Fix schema.json → codex-review-schema.json in SKILL.md quick ref

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Change reasoning effort back to xhigh from high
- Update cookbook URL to canonical developers.openai.com domain
  (old cookbook.openai.com returns 308 redirect)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dguido dguido merged commit 776ccc8 into main Feb 17, 2026
8 checks passed
@dguido dguido deleted the codex-exec-structured-output branch February 17, 2026 10:05
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