Repository navigation
fix(codex): make manual account selection immediate - #506
Conversation
|
Warning Review limit reached
Next review available in: 16 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (27)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea2766a739
ℹ️ 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".
| resetCodexRoutingForManualSelection(body.accountId ?? MAIN_CODEX_ACCOUNT_ID); | ||
| saveRuntimeConfig(config, runtimeConfig); | ||
| return jsonResponse({ ok: true, activeCodexAccountId: body.accountId }); | ||
| return jsonResponse({ ok: true, activeCodexAccountId: body.accountId, appliesImmediately: true }); |
There was a problem hiding this comment.
Avoid promising immediate use for ineligible selections
When this PUT selects an account that is under a preserved hard 429 cooldown, or whose known usage exceeds the enabled auto-switch threshold while a lower-usage account exists, the next resolver call chooses a fallback and may overwrite the active ID before the selected account handles any request. Returning appliesImmediately: true—alongside the new GUI copy promising that the next request will use the account—is therefore incorrect for these reachable cases; either give a manual selection a one-request override or report and document that application is conditional.
Useful? React with 👍 / 👎.
| | `POST /api/oauth/login` · `GET /api/oauth/status` | Start a provider OAuth flow and poll for completion. | | ||
| | `GET /api/codex-auth/accounts?refresh=1` | List main and pool accounts, force quota refresh, and report main-account `hasCredential` / terminal `needsReauth` state. | | ||
| | `PUT /api/codex-auth/active` · `PUT /api/codex-auth/auto-switch` · `PUT /api/codex-auth/failover` | Select the next-session account and configure pool routing. | | ||
| | `PUT /api/codex-auth/active` · `PUT /api/codex-auth/auto-switch` · `PUT /api/codex-auth/failover` | Select the account for the next request and configure pool routing. | |
There was a problem hiding this comment.
Update the stale manual-switch overview
This new next-request description contradicts the same guide's lines 82–83, which still say that manual selection affects only a new session and that an already-bound thread keeps its account; resetCodexRoutingForManualSelection() now clears all thread affinity, so that overview and its translated equivalents describe the opposite behavior. Update those bullets together with this endpoint row.
AGENTS.md reference: AGENTS.md:L78-L79
Useful? React with 👍 / 👎.
| const activeUsage = computeCodexUsageScore(quota, getPoolAccountPlan(config, active)); | ||
| // Unknown usage is not evidence that a user's explicit selection crossed the | ||
| // threshold. Wait for quota priming instead of rotating among guesses. | ||
| if (isUnknownUsage(activeUsage)) return active; |
There was a problem hiding this comment.
Keep a real 100% quota distinct from unknown usage
CODEX_UNKNOWN_USAGE_SCORE is exactly 100, while parsed quota percentages are clamped to the inclusive range 0–100, so this new early return also classifies a real, known 100% usage value as unknown. With auto-switch enabled and another account at lower usage, an exhausted active account now remains selected instead of switching at the configured threshold; the same guard also blocks preview and bound-thread reevaluation. Distinguish missing quota from a known 100% value and add a routing regression for this boundary.
AGENTS.md reference: AGENTS.md:L75-L77
Useful? React with 👍 / 👎.
…mmediate-account fix(codex): make manual account selection immediate
Summary
appliesImmediately: trueand align GUI, CLI, and localized docs with next-request semanticsValidation
Closes #504