Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/core/auth/token-refresher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export class TokenRefresher {
error.code === 'InvalidTokenException' ||
error.code === 'HTTP_401' ||
error.code === 'HTTP_403' ||
error.message.includes('Invalid refresh token provided'))
error.message.includes('Invalid refresh token provided') ||
error.message.includes('Invalid grant provided'))
) {
this.accountManager.markUnhealthy(account, error.message)
await this.repository.batchSave(this.accountManager.getAccounts())
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class AccountManager {
delete acc.unhealthyReason
delete acc.recoveryTime
kiroDb.upsertAccount(acc).catch(() => {})
writeToKiroCli(acc).catch(() => {})
writeToKiroCli(acc).catch((e) => logger.warn('Failed to write token back to Kiro CLI', e))
}
}
markRateLimited(a: ManagedAccount, ms: number): void {
Expand Down
2 changes: 2 additions & 0 deletions src/plugin/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ export function isPermanentError(reason?: string): boolean {
if (!reason) return false
return (
reason.includes('Invalid refresh token') ||
reason.includes('Invalid grant provided') ||
reason.includes('invalid_grant') ||
reason.includes('ExpiredTokenException') ||
reason.includes('InvalidTokenException') ||
reason.includes('HTTP_401') ||
Expand Down
3 changes: 2 additions & 1 deletion src/plugin/sync/kiro-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ export async function syncFromKiroCli() {
if (
existingById &&
existingById.is_healthy === 1 &&
existingById.expires_at >= cliExpiresAt
existingById.expires_at >= cliExpiresAt &&
existingById.expires_at > Date.now()
)
continue

Expand Down