feat(gui): show weighted Codex pool capacity and next recovery - #878
Conversation
Use configured plan weights to summarize routable Codex quota windows while retaining effective-account raw quota and incomplete coverage. Show next capacity recovery as a share of the weighted pool without changing routing or account selection. Refs lidge-jun#874
Carry weighted pool metadata through the provider workspace shell and reject stale per-account quota readings. Key report caching to a privacy-safe signature of every aggregation-relevant account state while keeping configured weight units internal. Refs lidge-jun#874
Document the Providers overview's weighted pool percentage, effective-account quota, recovery display, incomplete coverage, and display-only routing boundary. Refs lidge-jun#874
Replace stale provider quota state authoritatively, retain per-window coverage, and distinguish aggregate, fallback, and coverage-only reports. Reject cache commits when pool presentation state changes during a probe and allow recovery details to wrap in narrow panes. Refs lidge-jun#874
Keep pool account counts partitioned while reporting partial limit-window coverage separately. Render coverage-only reports in the Providers overview and expire stale effective-account fallbacks without restamping their quota data. Refs lidge-jun#874
|
Warning Review limit reached
Next review available in: 36 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 (10)
📝 WalkthroughWalkthroughThis change adds weighted Codex pool-capacity aggregation, freshness-aware quota reporting, strict GUI parsing, Providers overview rendering, partial-window indicators, localized strings, responsive styling, documentation, and tests. ChangesCodex pool capacity
Estimated code review effort: 5 (Critical) | ~90 minutes Sequence Diagram(s)sequenceDiagram
participant AccountStore
participant QuotaService
participant CapacityAggregator
participant ProviderOverview
AccountStore->>QuotaService: provide Codex account and quota state
QuotaService->>CapacityAggregator: aggregate eligible pool accounts
CapacityAggregator-->>QuotaService: weighted windows and coverage metadata
QuotaService-->>ProviderOverview: aggregate, fallback, or coverage-only report
ProviderOverview-->>ProviderOverview: render capacity, recovery, and partial-window status
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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: 74a6e22a8b
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 10
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Around line 27-46: Update the localized providers guides in
ja/guides/providers.md, ko/guides/providers.md, ru/guides/providers.md, and
zh-cn/guides/providers.md to include the English guide’s Pool capacity section:
configured-weight pool capacity estimates, the effective account’s raw quota,
reset recovery information, incomplete and partial-window coverage behavior, and
the display-only routing limitation. Translate the content appropriately while
preserving the existing Pool/Direct guidance.
In `@gui/src/components/provider-workspace/ProviderOverviewDashboard.tsx`:
- Around line 255-260: Update the recoveryRows rendering and its row key near
recoveryRows so each row uses a stable unique identifier based on its window
source rather than the display label. Distinguish fiveHour, weekly, monthly, and
each custom window (using an appropriate custom-window identity), while
preserving labels for display and avoiding collisions across localized standard
labels and raw custom labels.
In `@gui/src/components/provider-workspace/ProviderWorkspaceShell.tsx`:
- Around line 278-286: Add the cancelled check at the start of the quota
request’s catch handler, before setQuotaReports or writeSessionListCache can
run. Keep the existing freshQuotaReportRecord fallback unchanged, and ensure
rejected superseded or unmounted requests perform no state or cache updates
while preserving the finally loading cleanup.
In `@gui/src/i18n/de.ts`:
- Line 1383: Update the German translation value for pws.capacity.estimate to
grammatical wording that conveys an estimate calculated from the configured plan
weights, matching the English source meaning and preserving its use as the
ProviderCapacityQuota label.
In `@gui/src/i18n/ru.ts`:
- Line 1045: Update the Russian translation value for "pws.capacity.incomplete"
so the unknown-plan count is explicitly presented as a subset included within
the excluded-account count, matching the relationship expressed by the other
locale translations rather than as an additive parallel count.
In `@gui/src/provider-workspace/report.ts`:
- Around line 106-113: Rename the flatMap callback parameter in the
customWindows transformation from value to entry, updating all references within
that callback while preserving its existing filtering and mapping behavior.
In `@gui/tests/provider-capacity-shell.test.tsx`:
- Line 19: Update the recovery timestamp assertion near RECOVERY_AT to derive
the expected formatted value with the same Intl.DateTimeFormat configuration
used by ProviderCapacityQuota, including the test locale and ambient timezone,
instead of hardcoding date/time alternatives. Keep the assertion focused on the
formatter output so it remains valid across runner timezones.
- Around line 267-278: The aggregatePayload helper currently omits the
partialWindowAccounts and monthly members later assigned by the test, and the
test file is not type-checked in CI. Widen aggregatePayload’s declared payload
shape or include both members in its returned literal, then add the GUI test
TypeScript project to CI so provider-capacity-shell.test.tsx is checked.
In `@gui/tests/provider-capacity.test.ts`:
- Around line 100-107: Update the assertions in the provider capacity test to
scope each flex-wrap and overflow-wrap check to its intended selector, matching
the existing css.slice(css.indexOf(...)) pattern used for the container rule.
Ensure .pws-capacity-recovery assertions inspect only that rule and
.quota-stacked-limit-group assertions inspect only its rule, rather than the
entire stylesheet text.
In `@src/providers/codex-capacity.ts`:
- Around line 85-90: Update configuredWeight to use Object.hasOwn when checking
normalized against CODEX_CONFIGURED_CAPACITY_WEIGHTS, ensuring inherited
Object.prototype keys such as constructor, toString, and valueOf are rejected
and the function only returns configured numeric weights.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: be790c01-eace-4bae-85b8-98c8187c4557
📒 Files selected for processing (21)
docs-site/src/content/docs/guides/providers.mddocs-site/src/content/docs/guides/web-dashboard.mdgui/src/components/QuotaBars.tsxgui/src/components/provider-workspace/ProviderOverviewDashboard.tsxgui/src/components/provider-workspace/ProviderWorkspaceShell.tsxgui/src/i18n/de.tsgui/src/i18n/en.tsgui/src/i18n/ja.tsgui/src/i18n/ko.tsgui/src/i18n/ru.tsgui/src/i18n/zh.tsgui/src/provider-workspace/report.tsgui/src/styles/provider-overview-dashboard.cssgui/src/styles/provider-quota.cssgui/tests/provider-capacity-shell.test.tsxgui/tests/provider-capacity.test.tssrc/codex/auth-api.tssrc/providers/codex-capacity.tssrc/providers/quota.tstests/provider-capacity.test.tstests/provider-quota.test.ts
74a6e22 to
b4f963d
Compare
[GD] Verdict: approve-commentPR: Semantic propagation
UsefulnessReal fix for issue Bugs / correctness
Security
Spec / standards
Reviews
Base / CI
Gatenone — not draft, no WIP/do-not-merge, Bottom lineUseful, spec-complete, well-tested feature; every review thread is addressed and verified at the reviewed head. No blocking findings. Merge-ready. |
[GD] Merge readyPR: Reviews
Tip freshness
Checks
Residual
Ready to merge. |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs-site/src/content/docs/guides/web-dashboard.md`:
- Around line 108-112: Move the Providers overview paragraph from between the
Codex Auth introductory colon and its bullets to immediately after the final
bullet in that list, preserving its text and link. Keep the Codex Auth colon
directly followed by the intended bullet list.
In `@docs-site/src/content/docs/ja/guides/providers.md`:
- Around line 38-41: Update the account-pool links in the localized providers
guides for ja, ko, ru, and zh-cn to use the locale-specific Starlight-generated
heading fragments, or add a shared raw-HTML anchor to each translated dashboard
heading and reference it consistently.
In `@gui/src/components/QuotaBars.tsx`:
- Around line 312-320: Add role="note" to the partial-window span rendered by
QuotaBars for incomplete windows, preserving its visible text and title. Update
the corresponding test to query and assert the named note role using the
existing window-qualified label.
In `@src/providers/quota.ts`:
- Around line 261-277: Update the effective-account fallback around the quota
freshness check to exclude accounts that are paused or require reauthentication,
matching the eligibility behavior of currentQuotaForDisplay. Only return the
report when the quota is fresh and the active account is eligible; otherwise
preserve the existing aggregation fallback behavior.
- Around line 111-135: The cacheKeyWithAggregationState function must not call
listCodexAuthAccounts or otherwise perform upstream I/O while computing the
cache key. Replace the account-list fetch with an existing non-I/O in-memory
snapshot or version representing Codex pool state, and use it to derive the
aggregation signature while preserving the base-key behavior and unavailable
fallback. Ensure commit-time key calculation cannot trigger quota probes before
the provider-quota freshness check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ff97dbf4-6880-4ecb-aa3f-55736e7dfb5f
📒 Files selected for processing (23)
docs-site/src/content/docs/guides/providers.mddocs-site/src/content/docs/guides/web-dashboard.mddocs-site/src/content/docs/ja/guides/providers.mddocs-site/src/content/docs/ko/guides/providers.mddocs-site/src/content/docs/ru/guides/providers.mddocs-site/src/content/docs/zh-cn/guides/providers.mdgui/src/components/QuotaBars.tsxgui/src/components/provider-workspace/ProviderOverviewDashboard.tsxgui/src/components/provider-workspace/ProviderWorkspaceShell.tsxgui/src/i18n/de.tsgui/src/i18n/en.tsgui/src/i18n/ja.tsgui/src/i18n/ko.tsgui/src/i18n/ru.tsgui/src/i18n/zh.tsgui/src/provider-workspace/report.tsgui/src/styles/provider-overview-dashboard.cssgui/src/styles/provider-quota.cssgui/tests/provider-capacity-shell.test.tsxgui/tests/provider-capacity.test.tssrc/codex/auth-api.tssrc/providers/codex-capacity.tssrc/providers/quota.ts
- docs: keep the Providers overview paragraph after the Codex Auth bullet list - docs: stable codex-auth-and-account-pools anchors in ja/ko/ru/zh-cn - gui: expose the partial-window aria-label via role=note - quota: exclude paused/reauth accounts from the effective-account fallback - tests: reset the provider-quota reconcile guard between test files
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs-site/src/content/docs/ja/guides/web-dashboard.md`:
- Around line 86-87: Synchronize the translated dashboard guides with the
English Providers overview by adding the localized display-only weighted
capacity estimate link and summary after the account-pool list in
docs-site/src/content/docs/ja/guides/web-dashboard.md lines 86-87,
docs-site/src/content/docs/ko/guides/web-dashboard.md lines 86-87,
docs-site/src/content/docs/ru/guides/web-dashboard.md lines 89-90, and
docs-site/src/content/docs/zh-cn/guides/web-dashboard.md lines 80-81; preserve
the existing Codex Auth anchor and use the corresponding localized Providers
overview wording.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3df8b9d8-a570-4ef8-8fb7-533406fffa9e
📒 Files selected for processing (15)
docs-site/src/content/docs/guides/web-dashboard.mddocs-site/src/content/docs/ja/guides/web-dashboard.mddocs-site/src/content/docs/ko/guides/web-dashboard.mddocs-site/src/content/docs/ru/guides/web-dashboard.mddocs-site/src/content/docs/zh-cn/guides/web-dashboard.mdgui/src/components/QuotaBars.tsxgui/src/i18n/de.tsgui/src/i18n/en.tsgui/src/i18n/ja.tsgui/src/i18n/ko.tsgui/src/i18n/ru.tsgui/src/i18n/zh.tsgui/tests/provider-capacity-shell.test.tsxsrc/providers/quota.tstests/provider-account-quota.test.ts
|
Thanks @luvs01 — merging this. Why it helps: the Providers overview now reports the whole Codex pool's configured-weight capacity instead of only the persisted selected account, so an exhausted-but-selected account can no longer mask usable pool capacity. It keeps the effective account's raw quota, reset timing, and Ship it. |
Summary
+N% pool capacityrecovery only.Closes #874
Verification
bun run typecheckcd gui && bun run buildcd gui && bun run lintcd gui && bun run lint:i18ncd docs-site && bun run build(206 pages)bun run privacy:scangit diff --checkChecklist
Summary by CodeRabbit