fix(auth): include subscription in auth status for balance ring
Memind CI / Test, build, and release guards (push) Failing after 5m54s
Memind CI / Test, build, and release guards (push) Failing after 5m54s
Refresh/login previously dropped active subscription from the client user payload, so paid users saw a 0% balance ring despite valid plan quota. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+18
-11
@@ -331,17 +331,24 @@ export async function checkAuth(): Promise<AuthStatus> {
|
||||
}
|
||||
if (status.authenticated) resetUnauthorizedGuard();
|
||||
applyAgentCodeRunClientPolicy(status.agentCodeRun ?? null);
|
||||
if (status.authenticated && status.mode === 'user' && !status.capabilities) {
|
||||
try {
|
||||
const me = await getMe();
|
||||
return {
|
||||
...status,
|
||||
capabilities: me.capabilities,
|
||||
grantedSkills: me.grantedSkills,
|
||||
user: me.user,
|
||||
};
|
||||
} catch {
|
||||
return status;
|
||||
if (status.authenticated && status.mode === 'user') {
|
||||
const needsMeHydration =
|
||||
!status.capabilities
|
||||
|| !status.user
|
||||
|| !Object.prototype.hasOwnProperty.call(status.user, 'subscription');
|
||||
if (needsMeHydration) {
|
||||
try {
|
||||
const me = await getMe();
|
||||
return {
|
||||
...status,
|
||||
capabilities: me.capabilities ?? status.capabilities,
|
||||
grantedSkills: me.grantedSkills ?? status.grantedSkills,
|
||||
unrestricted: me.unrestricted ?? status.unrestricted,
|
||||
user: me.user,
|
||||
};
|
||||
} catch {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
return status;
|
||||
|
||||
Reference in New Issue
Block a user