fix(agent): Handle expired setup tokens without refresh token
Add validation to check for refresh token availability before attempting token refresh. Setup tokens that expire without a refresh token now return a clear error message instead of attempting an invalid refresh. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -222,7 +222,7 @@ export async function checkAccountHealth(
|
|||||||
try {
|
try {
|
||||||
// Use credential manager if provided, otherwise fall back to direct functions
|
// Use credential manager if provided, otherwise fall back to direct functions
|
||||||
let accessToken: string;
|
let accessToken: string;
|
||||||
let currentExpiresAt: number;
|
let currentExpiresAt: number | null;
|
||||||
let subscriptionType: string | null = null;
|
let subscriptionType: string | null = null;
|
||||||
|
|
||||||
if (credentialManager) {
|
if (credentialManager) {
|
||||||
@@ -293,7 +293,7 @@ export async function checkAccountHealth(
|
|||||||
...base,
|
...base,
|
||||||
credentialsValid: true,
|
credentialsValid: true,
|
||||||
tokenValid: true,
|
tokenValid: true,
|
||||||
tokenExpiresAt: new Date(currentExpiresAt).toISOString(),
|
tokenExpiresAt: currentExpiresAt ? new Date(currentExpiresAt).toISOString() : null,
|
||||||
subscriptionType,
|
subscriptionType,
|
||||||
usage,
|
usage,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user