fallback to API when Codex service fails#54
Conversation
🤖 Codex PR ReviewPlease ensure a human reviewer checks this PR before merging. |
a2a8a11 to
016ebb2
Compare
Co-Authored-By: Codex <noreply@openai.com>
016ebb2 to
3b8290e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2a8a11acc
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| exit_code=return_code, | ||
| workspace=workspace, | ||
| ) | ||
| if return_code == SERVICE_INF_FAILURE_EXIT_CODE or is_service_infrastructure_failure(_codex_log): |
There was a problem hiding this comment.
Fix the misspelled service failure constant
When CODEX_AUDIT_PROVIDER=codex, any nonzero service result skips the new provider == "auto" fallback branch and evaluates this condition, but SERVICE_INF_FAILURE_EXIT_CODE is undefined; the defined constant is SERVICE_INFRA_FAILURE_EXIT_CODE. This raises NameError before the script can post the intended failure comment or return the service exit code, so manual Codex-provider audit runs crash on service failures instead of reporting them cleanly.
Useful? React with 👍 / 👎.
| ) | ||
|
|
||
| print("Running Codex review via direct API") | ||
| return run_direct_api_review(prompt, complexity=complexity) |
There was a problem hiding this comment.
Enforce the PR API fallback allowlist
When CODEX_AUDIT_SERVICE_URL is set and the service call raises, this new branch always sends the full PR review prompt, including the diff, to run_direct_api_review. The PR workflow does not pass CODEX_AUDIT_API_FALLBACK_ALLOWED_SOURCE_REPOSITORIES, and this script never validates GITHUB_REPOSITORY against that allowlist, so any reusable-workflow caller with API secrets falls back to OpenAI/Anthropic even when the source repository is not approved for API fallback.
Useful? React with 👍 / 👎.
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce10a0b4f6
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| print(f"::warning::Codex service review failed; falling back to direct API: {exc}") | ||
| except (json.JSONDecodeError, OSError, urllib.error.URLError) as exc: |
There was a problem hiding this comment.
Keep request timeouts out of API fallback
When a urlopen submit or poll request times out, Python raises TimeoutError/URLError (both covered by this OSError handler), so the code falls through to run_direct_api_review even though service job timeouts are intentionally not treated as fallbackable by _service_review_should_fallback. In the poll-timeout case the service job may already be running, causing a duplicate direct API review instead of the intended skipped-review warning path.
Useful? React with 👍 / 👎.
| CODEX_SERVICE_FALLBACK_SIGNALS = ( | ||
| "429", | ||
| "too many requests", | ||
| "rate limit", | ||
| "quota", | ||
| ) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Summary