From bdcfc20c0f78a19d5f7ed306f3094ac6f978482c Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Wed, 29 Jul 2026 12:55:02 -0400 Subject: [PATCH] fix(cliproxy): classify Claude quota probe 429s --- src/cliproxy/quota/quota-fetcher-claude.ts | 13 ++++++++++++- .../cliproxy/quota-subcommand/sections/claude.ts | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/cliproxy/quota/quota-fetcher-claude.ts b/src/cliproxy/quota/quota-fetcher-claude.ts index 84863144..48f3897a 100644 --- a/src/cliproxy/quota/quota-fetcher-claude.ts +++ b/src/cliproxy/quota/quota-fetcher-claude.ts @@ -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}` } : {}), }; } diff --git a/src/commands/cliproxy/quota-subcommand/sections/claude.ts b/src/commands/cliproxy/quota-subcommand/sections/claude.ts index 3a80c74e..88b19f8e 100644 --- a/src/commands/cliproxy/quota-subcommand/sections/claude.ts +++ b/src/commands/cliproxy/quota-subcommand/sections/claude.ts @@ -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;