fix(cliproxy): classify Claude quota probe 429s

This commit is contained in:
Tam Nhu Tran committed 2026-07-29 13:22:21 -04:00
1 parent 09757b418e
commit bdcfc20c0f
2 files changed
+15 -2

No files matched your search

+12 -1
View File
@@ -295,10 +295,21 @@ async function runClaudeUsageFetch(
continue;
}
clearTimeout(timeoutId);
if (response.status === 429) {
return {
...buildEmptyResult('Claude usage status temporarily unavailable', accountId),
httpStatus: response.status,
errorCode: 'usage_probe_unavailable',
actionHint:
'Inference may still be available. Retry the Claude quota status check later.',
retryable: true,
...(retryAfter ? { errorDetail: `retry-after:${retryAfter}` } : {}),
};
}
return {
...buildEmptyResult(lastError, accountId),
httpStatus: response.status,
retryable: response.status === 429 || response.status >= 500,
retryable: response.status >= 500,
...(retryAfter ? { errorDetail: `retry-after:${retryAfter}` } : {}),
};
}
@@ -34,7 +34,9 @@ export function displayClaudeQuotaSection(
const defaultMark = accountInfo?.isDefault ? color(' (default)', 'info') : '';
if (!quota.success) {
console.log(` ${fail(accountLabel)}${defaultMark}`);
const statusIcon =
quota.errorCode === 'usage_probe_unavailable' ? warn(accountLabel) : fail(accountLabel);
console.log(` ${statusIcon}${defaultMark}`);
displayQuotaFailure(quota);
console.log('');
continue;