feat: improve account status interactions - #94
Conversation
…atus # Conflicts: # app/account-status/account-status.tsx # app/account-status/page.tsx # app/page-shell.tsx # e2e/account-status.spec.ts # lib/server/domain/account-status.ts # lib/server/proxy/codebuddy.ts # messages/en-US.json # messages/ja-JP.json # messages/zh-CN.json # playwright.config.ts # tests/server/account-status.test.ts
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (80.26%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
==========================================
- Coverage 94.73% 94.46% -0.28%
==========================================
Files 21 21
Lines 4178 4242 +64
Branches 1206 1232 +26
==========================================
+ Hits 3958 4007 +49
- Misses 220 235 +15
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1cd5a5efe7
ℹ️ 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".
| const [credentials, statuses] = await Promise.all([ | ||
| getAccountStatusCredentials(), | ||
| getAccountStatus(), | ||
| ]); |
There was a problem hiding this comment.
Authenticate before querying account statuses
When an admin account is configured, an unauthenticated request to /account-status executes this query before <AdminPage> checks the session and redirects in app/page.tsx. getAccountStatus() then sends eligible stored bearer tokens to the upstream quota, check-in, and model endpoints, allowing unauthenticated callers to trigger authenticated upstream traffic and consume server resources; move this loading behind the session check or into an authenticated loader.
Useful? React with 👍 / 👎.
| const credentials = await getAccountStatusCredentials(); | ||
| const [credentials, statuses] = await Promise.all([ | ||
| getAccountStatusCredentials(), | ||
| getAccountStatus(), |
There was a problem hiding this comment.
Avoid blocking page rendering on every upstream status fetch
For authenticated users with slow or unreachable upstreams, awaiting getAccountStatus() prevents any account-status UI from rendering. Each credential sequentially performs quota, check-in, and possibly model requests with 15-second timeouts, while getAccountStatus() processes groups of four serially, so one group can delay the page by roughly 45 seconds and additional groups multiply that delay; load these statuses through streaming/Suspense or after rendering the page shell instead.
Useful? React with 👍 / 👎.
| const response = await fetch('/admin-api/credentials/models', { | ||
| body: JSON.stringify({ filename, models: models.join(', ') }), | ||
| headers: { 'Content-Type': 'application/json' }, | ||
| method: 'PUT', |
There was a problem hiding this comment.
Serialize model saves per credential
When a user continues editing or blurs the field while an earlier save is still pending, the debounce and blur paths can now issue overlapping PUTs for the same filename because the input is no longer disabled. Each request overwrites supported_models, so network or storage latency can let the older request finish last and silently restore stale text; queue or version saves per filename while keeping the field editable.
Useful? React with 👍 / 👎.
Summary\n- improve account status presentation and quota visibility\n- add SSR account status hydration and model copy interactions\n- synchronize branch with latest main\n\n## Validation\n- lint, format, typecheck, and unit coverage pass\n- local patch-branch coverage gate reports 55.29% and was bypassed for push as requested