fix(agents): narrow billing error 402 regex to avoid false positives on issue IDs (#13827)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b0501bbab7
Co-authored-by: 0xRaini <190923101+0xRaini@users.noreply.github.com>
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Reviewed-by: @sebslight
This commit is contained in:
0xRain
2026-02-12 22:18:06 +08:00
committed by GitHub
parent 6a12d83450
commit 4f329f923c
4 changed files with 78 additions and 2 deletions

View File

@@ -90,7 +90,11 @@ export function isAnthropicBillingError(message: string): boolean {
if (lower.includes("billing") && lower.includes("disabled")) {
return true;
}
if (lower.includes("402")) {
if (
/["']?(?:status|code)["']?\s*[:=]\s*402\b|\bhttp\s*402\b|\berror(?:\s+code)?\s*[:=]?\s*402\b|\b(?:got|returned|received)\s+(?:a\s+)?402\b|^\s*402\s+payment/i.test(
lower,
)
) {
return true;
}
return false;