Skip to content

fix(agent-runtime): treat Volcengine AccountOverdueError wording as terminal - #2361

Merged
vastsa merged 1 commit into
vastsa:mainfrom
xpeng5278-web:fix/account-overdue-balance
Nov 15, 2026
Merged

vastsa merged 1 commit into
vastsa:mainfrom
xpeng5278-web:fix/account-overdue-balance

Conversation

@xpeng5278-web

Copy link
Copy Markdown
Contributor

Fixes #2360

Summary

classifyAgentError now treats Volcengine Ark's AccountOverdueError code and overdue balance / account has an overdue wording 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 structured code, so the 403 status that would have made the turn terminal never reaches the status table.

Fix

  • EXHAUSTED_QUOTA_CODE_PATTERN gains AccountOverdueError.
  • EXHAUSTED_QUOTA_MESSAGE_PATTERN gains overdue balance and account has an overdue.
  • A bare overdue, account, balance, credits, forbidden, or insufficient credentials is unchanged. Ordinary 403s stay PROVIDER_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, the AccountOverdueError: prefix, the official JSON body, and a structured { code: "AccountOverdueError" }, each as a raw string and Error; status: 429 and status: 400; a 403 body that still carries the overdue wording; negatives for overdue library book, bare overdue / account / balance / credits, insufficient credentials, Forbidden, and a plain 403 Forbidden.
  • Before the fix (tests only, on main @ 525ec4986): agent-errors 7 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 in 02-agent-runtime.md.

…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.

@aiuo-codepilot aiuo-codepilot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vastsa

vastsa commented Nov 15, 2026

Copy link
Copy Markdown
Owner

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 vastsa left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vastsa
vastsa merged commit 2270533 into vastsa:main Nov 15, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Volcengine Ark AccountOverdueError is retried when the HTTP status is missing

3 participants