feat(review): codex branch for one-shot PR review#490
Open
dcellison wants to merge 1 commit into
Open
Conversation
Phase 4 of the codex backend epic. Adds the codex branch to run_review
so GitHub webhook-driven PR reviews run through codex on a codex-active
install:
- run_review codex branch invokes `codex exec --json --model <model>`
with the model from get_model_for(ModelRole.PR_REVIEW, "codex",
override=os.environ.get("PR_REVIEW_MODEL_CODEX", "")). sudo -H -u wrap
when claude_user is set so codex reads ~<user>/.codex/auth.json
instead of the service user's home. start_new_session in cross-user
mode so a timeout kill collects both sudo and the codex grandchild.
CODEX_BIN env override honored so installs where codex lives in a
per-os_user home (not on the service user's PATH) still resolve the
absolute binary.
- New kai.codex_exec module hosts the schema-defensive NDJSON parser
(extract_codex_text + private _recover_agent_message_text). Both
triage.py and review.py import from there so review.py does not
reach into triage.py for a generic codex helper. Codex re-review
of #489 made canonical helpers an explicit aesthetic preference.
- Codex re-review of #489 also caught that get_effective_provider
needed the codex->openai rule; that fix landed in #489. No new
config plumbing needed here; the webhook handler already threads
per-user agent_backend / provider into review_pr and run_review.
- Tests: TestRunReviewCodex (11 tests) mirrors TestRunTriageCodex
argv/sudo/timeout/extraction coverage; TestExtractCodexText moved
from test_triage.py to test_codex_exec.py (location follows
implementation).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 4 of #480. Adds the codex branch to
run_reviewso GitHub webhook-driven PR reviews route through codex on a codex-active install, parallel to the codex triage branch that shipped in #483.run_reviewcodex branch:codex exec --json --model <model>;sudo -H -u <user>wrap whenclaude_useris set so codex reads~<user>/.codex/auth.json;start_new_sessionin cross-user mode so timeout kills sweep both sudo and the codex grandchild;CODEX_BINenv honored for installs where codex lives in a per-os_user home not on the service user's PATH.get_model_for(ModelRole.PR_REVIEW, "codex", override=os.environ.get("PR_REVIEW_MODEL_CODEX", "")). Registry row was added in feat(config): per-role model registry for multi-backend agent calls #481; codex-row validity is enforced atload_configtime by the check shipped in fix(install): codex wizard hardening (#486) #489.kai.codex_execmodule hosts the schema-defensive NDJSON parser (extract_codex_textplus private_recover_agent_message_text). Bothtriage.pyandreview.pyimport from there, so the review path does not reach into the triage module for a generic codex helper.agent_backend/providerintoreview_prandrun_review.Test plan
make test(3145 passed, 1 skipped)make check(ruff check + ruff format)TestRunReviewCodex(11 new tests) mirrorsTestRunTriageCodexcoverage: argv shape,CODEX_BINoverride, registry-vs-env model resolution, no-sudo and sudo-wrap paths, no--max-budget-usd, NDJSON text extraction, non-zero exit raises, timeout-killpg, stdin carries prompt.TestExtractCodexText(11 tests) moved fromtest_triage.pytotest_codex_exec.py.