Repository navigation
fix(agent-runtime): treat Volcengine AccountOverdueError wording as terminal - #2361
Conversation
…erminal Volcengine Ark reports an overdue account as AccountOverdueError. When pi-ai drops the HTTP status, the leftover message or structured code was classified as retryable and spent the provider retry budget. An overdue balance does not recover by backing off.
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only preliminary review of PR 2361. The change extends the exhausted-quota code and message patterns and adds tests plus one spec sentence. The regex and tests appear internally consistent: `AccountOverdueError` is a word-bounded code alternation, `overdue balance` and `account has an overdue` are the added message phrases, and negatives such as bare `overdue`/`account`/`balance` are consistent with the added alternatives. No concrete defect is evidenced by the quoted added lines. Verification limits: I could not run tests or typecheck, and I could not inspect surrounding `classifyAgentError` control flow beyond the shown diff, so behavior claims (e.g. ordering before the 403/status table) are not independently confirmed here.
No evidenced findings in the supplied diff.
Head: d03fd1f
Base: 043d11c
CI: pending; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
|
Independent validation: reproduced the original missing classification with candidate tests against baseline agent-errors.ts (7 failures /124 passes). Candidate passes 190 targeted tests; latest-main integration 5972ce1c (base 3221341, including #2359/#2363) passes 196/196. Built its production sidecar and e2e-provider-retry-idle passes abort-backoff, retry-after and stalled-request with expected request counts. Diff check passes. Initial Electron CI failed before tests while downloading Electron (fetch failed); reran failed jobs, currently still running transcript rendering/disclosure. Waiting for that gate before merge; no live provider request or native client validation claimed. |
vastsa
left a comment
There was a problem hiding this comment.
Independent baseline reproduction and integration validation are recorded above (196/196 tests and production provider-retry-idle E2E 3/3). Rechecked origin/main remains 3221341, matching tested integration 5972ce1c. Electron rerun now succeeds; all six Actions checks pass. Vercel account deployment is blocked independently of this runtime-only patch. The minimal classification change resolves the demonstrated terminal billing error without broadening unrelated overdue/account wording.
Fixes #2360
Summary
classifyAgentErrornow treats Volcengine Ark'sAccountOverdueErrorcode andoverdue balance/account has an overduewording as terminal billing exhaustion. A statusless body or a gateway 429 no longer spends the retry budget.Root cause
The exhaustion matchers already covered
insufficient credits/insufficient balance/Payment Required/credit_balance_exhausted, but not this provider spelling. pi-ai often keeps only the message text or a structuredcode, so the 403 status that would have made the turn terminal never reaches the status table.Fix
EXHAUSTED_QUOTA_CODE_PATTERNgainsAccountOverdueError.EXHAUSTED_QUOTA_MESSAGE_PATTERNgainsoverdue balanceandaccount has an overdue.overdue,account,balance,credits,forbidden, orinsufficient credentialsis unchanged. Ordinary 403s stayPROVIDER_UNAUTHORIZED. The spec's billing-exhaustion sentence lists the new wording. The existing pre-status-table check applies, including HTTP 429.Tests
agent-errors.test.ts: the official sentence, theAccountOverdueError:prefix, the official JSON body, and a structured{ code: "AccountOverdueError" }, each as a raw string andError;status: 429andstatus: 400; a 403 body that still carries the overdue wording; negatives foroverdue library book, bareoverdue/account/balance/credits,insufficient credentials,Forbidden, and a plain403 Forbidden.main@525ec4986):agent-errors7 failed / 124 passed (131). After: 131/131.tsc -p packages/agent-runtime/tsconfig.json --noEmit: exit 0.Scope
agent-errors.ts, its tests, and one sentence in02-agent-runtime.md.