You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The local skill now has TWO backends, dispatched by `--backend {auto,codex,api}`:
- `codex`: invokes `codex exec` CLI agentically (grep, multi-turn, file
loading), matching the CI Codex reviewer's quality. Requires `codex`
installed (`brew install --cask codex` / `npm install -g @openai/codex`)
and `codex login` completed.
- `api` (existing): single-shot OpenAI Responses API. Faster, cheaper,
but won't surface cross-surface or pattern-wide findings.
Default `--backend auto` picks codex when `codex` is on PATH AND
`~/.codex/auth.json` exists; falls back to api otherwise.
CI parity for the codex path (pinned to match the CI Codex action):
- model: gpt-5.4
- effort: model_reasoning_effort=xhigh via `-c` (NOT `reasoning_effort` —
Codex silently ignores unknown `-c` keys; `reasoning_effort` produces
"reasoning effort: none" while `model_reasoning_effort` produces
"reasoning effort: xhigh", verified against codex 0.130.0)
- sandbox: read-only (permits shell exec — `rg`, `grep`, `git diff` —
but blocks filesystem writes and most network)
- prompt via stdin (avoids ARG_MAX edge cases for compiled prompts that
can hit hundreds of KB); mirrors CI's `prompt-file:` flow
Skip irrelevant flow under codex backend (warn-and-ignore):
- `--context standard/deep` source-file preloading
- `--token-budget` pruning
- `--include-files` staging
- `--repo-root` requirement (codex falls back to cwd)
The script warns when these flags are passed under `--backend codex`.
Error handling for codex path:
- Non-zero exit → RuntimeError with codex's stderr bubbled verbatim
- Empty `-o` output file → RuntimeError
- KeyboardInterrupt → cleanup partial output, propagate
- stderr streamed to user during run (Codex events: file reads, tool
invocations) so 3-15 min runs aren't silent
Tests added (25 new):
- TestBackendDetection (6): auto/explicit, codex-missing error
- TestBuildCodexCmd (7): pin literal `model_reasoning_effort=xhigh`
token, sandbox=read-only, --cd, -o, no positional prompt
- TestCallCodex (6): subprocess argv, stdin pass-through, output read,
nonzero-exit + empty-output error paths
- TestCodexBackendDocConsistency (2): skill doc must enumerate the
backend choices and the codex install command
196 tests pass. Lint state matches origin/main (4 pre-existing warnings,
none introduced).
Validated end-to-end with a live `codex exec` smoke test against this
PR's own diff. Codex correctly produced a structured review (Overall
Assessment / Executive Summary / P0/P1/P2 severity bands) and surfaced
two real P1 regressions in the initial impl (--repo-root validation
running before backend resolution; --include-files not gated on backend
== api). Both are addressed in this commit; the live-codex smoke test
itself is the strongest validation that the backend works.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Run a structured code review using the OpenAI Responses API. Reviews changes
8
+
Run a structured code review using either the **Codex CLI** (agentic, matches CI
9
+
quality) or the **OpenAI Responses API** (single-shot, faster). Reviews changes
9
10
against the same methodology criteria used by the CI reviewer, but adapted for local
10
11
pre-PR use. Designed for iterative review/revision cycles before submitting a PR.
11
12
13
+
## Backend selection
14
+
15
+
Two backends are supported:
16
+
17
+
| Backend | Latency | Cost | Quality |
18
+
|---|---|---|---|
19
+
|`api` (`gpt-5.4`) | 30-60s | $0.05-0.50/run, metered via `OPENAI_API_KEY`| Single-shot — won't grep, can't load files on its own initiative |
20
+
|`codex` (any auth) | 3-15 min | depends on your `codex login` mode (subscription vs API key) — see codex docs | Agentic — matches CI Codex reviewer, can grep / load files / multi-turn |
21
+
22
+
Choose with `--backend {auto,codex,api}` (default `auto`):
23
+
24
+
-**`auto`**: pick `codex` if the `codex` CLI is installed AND `~/.codex/auth.json`
25
+
exists (i.e. `codex login` has been completed); otherwise fall back to `api`.
26
+
-**`codex`**: requires `codex` CLI installed (`brew install --cask codex` or
27
+
`npm install -g @openai/codex`) and `codex login` completed.
28
+
-**`api`**: requires `OPENAI_API_KEY` env var. Fast iteration mode.
29
+
30
+
Notes:
31
+
-`codex` uses `--sandbox read-only`, which permits shell command execution
32
+
(`rg`, `grep`, `git diff`) inside Codex's agentic loop — the "read-only" name
33
+
refers to filesystem writes and network access, not shell exec. This is what
34
+
enables the agentic audits.
35
+
- Long Codex runs (3-15 min) can be cancelled with CTRL-C; the partial output is
36
+
cleaned up automatically.
37
+
-`--context` and `--token-budget` are ignored under the codex backend (Codex
38
+
chooses what to load on its own); the script warns if you pass them.
0 commit comments