Add a native sdk="codex" adapter that reuses the local Codex CLI sign-in and prefers Codex Desktop's bundled CLI on Windows.
Add RAE CLI/configuration support, model selection (default gpt-6-luna), session/history usage reporting, resume dispatch, and Codex login/browser-provider preflight.
Provide Playwright MCP configuration per Codex invocation for agent_provider="auto"; require an observed MCP browser call and a non-empty HAR before reporting capture success.
Add adapter/CLI tests and document the setup and limitations. A ranked-list prompt rule safely omits only unidentified all-zero aggregate rows.
Verification
Codex-specific focused tests: 13 passed.
Ruff on changed Python modules and tests: passed.
Staged git diff --check: passed.
Codex Desktop CLI 0.166.0-alpha.5.1 accepted gpt-6-luna and returned OK (18,542 input tokens, 11,776 cached, 5 output tokens).
Prior end-to-end RAE capture 5bbef964224a was completed with gpt-6.1-sol: seven Playwright MCP calls, a 179-entry HAR, public endpoint HTTP 200 / 672 rows, and a reviewed client whose top 15 IDs/token totals matched the captured response sidecar. No OpenRouter API key, login, cookie, or API credential was used.
A broader selected regression run had 200 passes and one unrelated UTF-8 TTY-detection test timeout (test_no_tty_no_subcommand_exits_2[utf-8], 10-second uv run limit); one pre-existing Claude interruption coroutine warning appeared. The full repository suite was not run.
The complete browser E2E was not repeated with gpt-6-luna because the prior run reported 587,099 input tokens. Luna-specific verification in this contribution is a short CLI smoke call plus focused tests; the previous full RAE flow is evidence for the adapter on gpt-6.1-sol.
This implementation was prepared with Codex assistance at Leon's request. Leon reviewed the end-to-end evidence and requests contributor credit for the feature request and validation if the PR is accepted.
Confidence Score: 3/5
The conflicting capture instructions and relative-output failures must be fixed before merging; the browser-visibility and follow-up issues are non-blocking on their own.
### Issue 1
src/reverse_api/codex_engineer.py:466-469
Every Codex capture is told to find “the rankings GET request” and return only its first 15 rows, even when the user requests an unrelated API. Executing prompt construction for a weather client requesting all 48 hourly records confirmed that these conflicting instructions reach Codex alongside the user's task. This can divert capture from the requested endpoints or restrict the requested results. Remove these task-specific instructions before merging, or include them only when the user requests them.
### Issue 2
src/reverse_api/codex_engineer.py:494-499
With a relative output directory such as `-o runs`, the prompt and browser environment retain paths such as `runs/scripts/<run-id>` and `runs/har`, but Codex starts inside the resolved `runs` directory. Those paths consequently point beneath `runs/runs`, while Python checks the original locations. Executing the adapter with controlled child processes reproduced both the missing-HAR and missing-client failures; the same flow succeeded with an absolute output directory. Resolve output-derived paths before passing them to Codex or its browser server. This needs fixing before merging because a supported output-directory choice causes generation to report failure.
### Issue 3
src/reverse_api/codex_engineer.py:482-491
Both launch branches always include `--headless`, although the constructor accepts and saves `headless=False`. Users therefore cannot watch a Codex capture in a visible browser, even when they leave `--headless` off. Argument-generation checks confirmed this for both branches, and a Chromium probe using the generated setting confirmed headless operation. This is a non-blocking option-handling defect; add the flag only when `self.headless` is true.
### Issue 4
src/reverse_api/codex_engineer.py:415-417
Both Codex entry points return immediately after the first turn instead of offering the shared follow-up prompt. Executing interactive generation and capture confirmed that neither asks for another message, including after resuming a session. Users must explicitly resume the run for each refinement rather than continuing the open conversation. This is a non-blocking interaction limitation; add a follow-up loop that reuses the recorded Codex session and keeps the latest successful result.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
Adds Codex as a selectable backend for capture and HAR-based generation.
Codex can generate clients from HAR files or browser captures.
Automatic agents follow a shared rule for unidentified ranked-list rows.
Merge assessment: not ready to merge until the task-specific capture instructions and relative-path failures are fixed.