feat(gui): show weighted Codex pool capacity and next recovery - #878
feat(gui): show weighted Codex pool capacity and next recovery#878luvs01 wants to merge 8 commits into
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
📝 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 coverage tests. ChangesCodex pool capacity
Estimated code review effort: 5 (Critical) | ~90 minutes Possibly related PRs
Suggested labels: 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
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