fix(agent): Handle optional OAuth fields in usage.ts credential reader

Updated checkAccountHealth to handle setup tokens with null expiresAt:
- Changed currentExpiresAt type from number to number | null
- Use conditional for tokenExpiresAt ISO string conversion

This completes the OAuth setup token support across all credential
reading and validation functions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Lukas May
2026-02-10 09:50:46 +01:00
parent b021b9690e
commit e35927f321

View File

@@ -327,6 +327,11 @@ export async function ensureAccountCredentials(configDir: string): Promise<boole
return true;
}
if (!credentials.refreshToken) {
log.error({ configDir }, 'setup token expired, no refresh token available');
return false;
}
log.info({ configDir }, 'credentials expired, refreshing before spawn');
const refreshed = await refreshToken(credentials.refreshToken);
if (!refreshed) {