mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-11 03:13:12 +00:00
fix(cliproxy): classify Claude quota probe 429s
This commit is contained in:
1 parent
09757b418e
commit
bdcfc20c0f
2 files changed
+15
-2
No files matched your search
@@ -295,10 +295,21 @@ async function runClaudeUsageFetch(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
clearTimeout(timeoutId);
|
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 {
|
return {
|
||||||
...buildEmptyResult(lastError, accountId),
|
...buildEmptyResult(lastError, accountId),
|
||||||
httpStatus: response.status,
|
httpStatus: response.status,
|
||||||
retryable: response.status === 429 || response.status >= 500,
|
retryable: response.status >= 500,
|
||||||
...(retryAfter ? { errorDetail: `retry-after:${retryAfter}` } : {}),
|
...(retryAfter ? { errorDetail: `retry-after:${retryAfter}` } : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ export function displayClaudeQuotaSection(
|
|||||||
const defaultMark = accountInfo?.isDefault ? color(' (default)', 'info') : '';
|
const defaultMark = accountInfo?.isDefault ? color(' (default)', 'info') : '';
|
||||||
|
|
||||||
if (!quota.success) {
|
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);
|
displayQuotaFailure(quota);
|
||||||
console.log('');
|
console.log('');
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in new issue
Block a user