feat(oauth): show credential age and keep provider status current - #943
Conversation
- The credential status endpoint and provider form show when the login was connected, last refreshed and when the key expires. - Saving a new OAuth credential (or backfill-linking a provider) and deleting one now rebuild the config cache, so runtime oauth_account hydration no longer goes stale until a restart or provider re-save. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
🔍 OpenCodeReview found 1 issue(s) in this PR.
|
| const result = await api.getOAuthCredentialStatus(providerId, accountId); | ||
| if (cancelled) return; | ||
| setOauthCredentialReady(!!result.ready); | ||
| setOauthCredentialStatus(result.ready ? result : null); |
There was a problem hiding this comment.
Race with delete: the new 10s poll can be in flight while handleDeleteOAuthCredential runs. When there's no active session, oauthStatus stays undefined, so the delete doesn't change any effect dependency and the effect never cancels. If a poll that started before the delete resolves after it, it sets ready: true and the old credential status again. The credential line and Delete button then come back for up to 10s after a successful delete. Before this change the check ran only once, so this couldn't happen. Fix: keep a request/generation counter in a ref, bump it in the delete handler, and drop any poll result whose generation is stale (or add a credentialVersion state to the effect deps and bump it on delete).
Suggestion:
| const result = await api.getOAuthCredentialStatus(providerId, accountId); | |
| if (cancelled) return; | |
| setOauthCredentialReady(!!result.ready); | |
| setOauthCredentialStatus(result.ready ? result : null); | |
| const gen = credentialGenRef.current; | |
| const result = await api.getOAuthCredentialStatus(providerId, accountId); | |
| if (cancelled || gen !== credentialGenRef.current) return; | |
| setOauthCredentialReady(!!result.ready); | |
| setOauthCredentialStatus(result.ready ? result : null); |
🔍 OpenCodeReview — detailed findings✅ Passing — no critical/high findings. Reviewed 14 file(s), 1 finding(s) total.
|
Overview
OAuth provider settings now show when an account was connected, when its key was last refreshed, and when it expires. The status updates while the provider form stays open, and completed logins appear only after their credentials are saved.
✨ New Features
🐛 Bug Fixes
🔧 Improvements
Verification
bun run test— 122 files, 1,017 tests passedbun run typecheckbun run lint:checkbun run format:check