Skip to content
This repository was archived by the owner on Jul 3, 2026. It is now read-only.

fallback to API when Codex service fails#54

Merged
Pigbibi merged 3 commits into
mainfrom
feat/codex-service-auto-fallback
Jul 2, 2026
Merged

fallback to API when Codex service fails#54
Pigbibi merged 3 commits into
mainfrom
feat/codex-service-auto-fallback

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • let monthly audit provider=auto fall back to API reviewers on any Codex service failure
  • let PR review workflow fall back to direct API when the service path fails
  • add regression coverage for monthly audit and PR review fallback
  • document the service-first / API-fallback behavior in the README

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🤖 Codex PR Review

⚠️ Review skipped: The Codex review could not be completed.

Codex service request failed: 401 {"error": "OIDC workflow_ref is not allowed"}

Please ensure a human reviewer checks this PR before merging.

@Pigbibi Pigbibi force-pushed the feat/codex-service-auto-fallback branch from a2a8a11 to 016ebb2 Compare July 2, 2026 19:46
Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi Pigbibi force-pushed the feat/codex-service-auto-fallback branch from 016ebb2 to 3b8290e Compare July 2, 2026 19:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread scripts/run_monthly_codex_audit.py Outdated
exit_code=return_code,
workspace=workspace,
)
if return_code == SERVICE_INF_FAILURE_EXIT_CODE or is_service_infrastructure_failure(_codex_log):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Pigbibi and others added 2 commits July 3, 2026 03:56
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi Pigbibi merged commit 65b8a98 into main Jul 2, 2026
4 checks passed
@Pigbibi Pigbibi deleted the feat/codex-service-auto-fallback branch July 2, 2026 20:01

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +474 to +475
print(f"::warning::Codex service review failed; falling back to direct API: {exc}")
except (json.JSONDecodeError, OSError, urllib.error.URLError) as exc:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +38 to +43
CODEX_SERVICE_FALLBACK_SIGNALS = (
"429",
"too many requests",
"rate limit",
"quota",
)

This comment was marked as off-topic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant