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:
Lukas May
2026-02-10 09:50:40 +01:00
parent a59e18710f
commit b021b9690e

View File

@@ -222,7 +222,7 @@ export async function checkAccountHealth(
try {
// Use credential manager if provided, otherwise fall back to direct functions
let accessToken: string;
let currentExpiresAt: number;
let currentExpiresAt: number | null;
let subscriptionType: string | null = null;
if (credentialManager) {
@@ -293,7 +293,7 @@ export async function checkAccountHealth(
...base,
credentialsValid: true,
tokenValid: true,
tokenExpiresAt: new Date(currentExpiresAt).toISOString(),
tokenExpiresAt: currentExpiresAt ? new Date(currentExpiresAt).toISOString() : null,
subscriptionType,
usage,
};