Replies: 1 comment
|
Verified this against The gap is real. The mapping moved since you read it — it now lives in export function httpErrorCode(status: number, error?: WireError['error']): string {
if (status === 401 || status === 403) return 'AUTH'
if (status === 413) return 'INVALID_REQUEST'
const detail = [error?.code, error?.type, error?.message].filter(Boolean).join(' ')
if (isQuotaExceededError(detail)) return QUOTA_EXCEEDED_CODE
if (status === 429) return 'RATE_LIMIT'
if (status === 400) { ... }
if (status >= 500) return 'SERVER'
return `HTTP_${status}` // ← 402 lands here
}No status branch matches 402, so an empty or differently-worded body surfaces as But look at the other protocol path in the same package — else if (isQuotaExceededError(detail) || status === 402) code = 'QUOTA'It has had the exact rule you are proposing, for as long as the two paths have existed separately. So this is not a classification decision that needs to be made — it is an inconsistency between two code paths in one package, and the correct shape is already in the tree. That reframes the fix: it is a one-line parity change ( Worth noting in the report as well: (I also read your companion post #7053 — the balance-gate half is separately answerable, and the |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
A long run died on
HTTP 402 (insufficient provider balance)after ~20.8M input tokens, with no deliverable and no top-up guidance. The harness already has a terminal quota failure code, but a 402 cannot reach it.Diagnosis
httpErrorCode()inpackages/llm/llm-deepseek/src/adapter.tsmaps:AUTHINVALID_REQUESTQUOTA_EXCEEDED_CODERATE_LIMITINVALID_REQUEST>= 500→SERVERHTTP_${status}Nothing matches status 402. Both
QUOTA_EXCEEDED_CODE = 'QUOTA'andisQuotaExceededError()already exist inpackages/llm/llm/src/error.ts, and the matcher does recognize "insufficient balance" wording — but only from the response body text. When the body is empty, non-JSON, or worded differently, the failure surfaces asHTTP_402, so:QUOTAcode (user messaging, failure policy, UX) never fires.Proposed fix
Return
QUOTA_EXCEEDED_CODEfor status 402 ahead of the body-text check. 402 is the canonical insufficient-balance status; the status alone is sufficient evidence, and the wording check can stay as a fallback for other statuses.Notes
QUOTAis deliberately absent fromDEFAULT_RETRYABLE_CODESinpackages/llm/llm/src/retry-policy.ts, andHTTP_402is not eligible either — so the ~20.8M tokens were spent on real work while the balance drained, and then the run ended with nothing to show.Environment
DSH
0.1.5-rc.2, DeepSeek provider, failure surfaced asHTTP 402; ending account balance −$0.24.All reactions