GH#24694: verify OpenAI OAuth fallback health#24695
Conversation
Completion Summary
aidevops.sh v3.20.54 with gpt-5.5 spent 2h 1m and 197,993 tokens on this with the user in an interactive session. |
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)🚫 Excluded labels (none allowed) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report SonarCloud: 0 bugs, 0 vulnerabilities, 0 code smells Thu Jun 11 18:08:04 UTC 2026: Code review monitoring started 📈 Current Quality Metrics
Generated on: Thu Jun 11 18:08:07 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
Shell Function Complexity Regression Gate✅ No regression — no new function(s) >100 lines.
|
Bash 3.2 Compatibility Regression Gate✅ No regression — no new bash 3.2-incompatible construct(s).
|
Qlty Smell Regression Gate✅ No change — smell count unchanged.
|
Admin Merge Fallback (t2247)Branch protection blocked the plain Merge method: Original branch-protection errorRemediation: If this bypass was unintended, revert with aidevops.sh v3.20.54 with unknown spent 2h 2m and 206,954 tokens on this with the user in an interactive session. |
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Code Review
This pull request enhances the OpenAI OAuth fallback verification logic by requiring a successful live HTTP probe with the access token instead of relying solely on the presence of a refresh token, preventing quota-exhausted accounts from being marked as healthy. It also adds corresponding test cases and a curl stub to cover various failure scenarios. The reviewer noted that successful verification currently has its rich health metrics overwritten by dummy values in _probe_check_oauth_fallback, and suggested returning the verification exit code immediately to preserve the actual metrics.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if [[ "$provider" == openai ]]; then | ||
| local oauth_exit=0 | ||
| _probe_openai_oauth_fallback_verified "$auth_file" "$quiet" || oauth_exit=$? | ||
| if [[ "$oauth_exit" -ne 0 ]]; then | ||
| [[ "$quiet" != "true" ]] && print_warning "$provider: env key rejected (HTTP 401/403); OpenAI OAuth API verification failed" | ||
| return "$oauth_exit" | ||
| fi | ||
| fi |
There was a problem hiding this comment.
When _probe_openai_oauth_fallback_verified succeeds, it has already executed a live HTTP probe via _probe_execute_http, which records the actual HTTP status, response time, and models count in the database. However, the subsequent lines in _probe_check_oauth_fallback immediately overwrite this rich health record with dummy values (0 response time, 0 models count). Returning the exit code of _probe_openai_oauth_fallback_verified immediately upon successful verification preserves the actual metrics in the database and avoids masking potential errors with a hardcoded return value.
| if [[ "$provider" == openai ]]; then | |
| local oauth_exit=0 | |
| _probe_openai_oauth_fallback_verified "$auth_file" "$quiet" || oauth_exit=$? | |
| if [[ "$oauth_exit" -ne 0 ]]; then | |
| [[ "$quiet" != "true" ]] && print_warning "$provider: env key rejected (HTTP 401/403); OpenAI OAuth API verification failed" | |
| return "$oauth_exit" | |
| fi | |
| fi | |
| if [[ "$provider" == openai ]]; then | |
| local oauth_exit=0 | |
| _probe_openai_oauth_fallback_verified "$auth_file" "$quiet" || oauth_exit=$? | |
| if [[ "$oauth_exit" -ne 0 ]]; then | |
| [[ "$quiet" != "true" ]] && print_warning "$provider: env key rejected (HTTP 401/403); OpenAI OAuth API verification failed" | |
| fi | |
| return "$oauth_exit" | |
| fi |
References
- In shell scripts, functions that wrap a command should propagate its exit code to the caller. Avoid masking potential errors with a hardcoded
return 0. Instead, usereturn $?or capture the exit code and return it.
|
Shell Nesting Depth Regression Gate✅ No regression — no new file(s) with nesting depth >8.
|
File Size Regression Gate✅ No regression — no new file(s) >1500 lines.
|
Released Completion Summary
aidevops.sh v3.20.55 plugin for OpenCode v1.17.3 with gpt-5.5 spent 2h 5m and 25,203 tokens on this with the user in an interactive session. Overall, 3m since this issue was created. |



Summary
OpenAI OAuth fallback now requires a non-expired access token verified through the OpenAI provider HTTP probe before recording healthy. Refresh-token presence alone fails closed, and OAuth verification failures preserve quota/auth/network classifications.
Files Changed
.agents/scripts/model-availability-probe-lib.sh,.agents/scripts/tests/test-model-availability-oauth-probe.sh
Runtime Testing
Resolves #24694
aidevops.sh v3.20.54 with gpt-5.5 spent 2h 1m and 197,993 tokens on this with the user in an interactive session.