Skip to content

Commit 8bf64f2

Browse files
CryUshioaltaywtf
andauthored
fix: recognize Poe 402 'used up your points' as billing for fallback (openclaw#42278)
Merged via squash. Prepared head SHA: f3cdfa7 Co-authored-by: CryUshio <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
1 parent 466cc81 commit 8bf64f2

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Docs: https://docs.openclaw.ai
6565
- Agents/fallback cooldown probing: cap cooldown-bypass probing to one attempt per provider per fallback run so multi-model same-provider cooldown chains can continue to cross-provider fallbacks instead of repeatedly stalling on duplicate cooldown probes. (#41711) Thanks @cgdusek.
6666
- Telegram/direct delivery: bridge direct delivery sends to internal `message:sent` hooks so internal hook listeners observe successful Telegram deliveries. (#40185) Thanks @vincentkoc.
6767
- Plugins/global hook runner: harden singleton state handling so shared global hook runner reuse does not leak or corrupt runner state across executions. (#40184) Thanks @vincentkoc.
68+
- Agents/fallback: recognize Poe `402 You've used up your points!` billing errors so configured model fallbacks trigger instead of surfacing the raw provider error. (#42278) Thanks @CryUshio.
6869

6970
## 2026.3.8
7071

src/agents/pi-embedded-helpers.isbillingerrormessage.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,12 @@ describe("classifyFailoverReason", () => {
646646
expect(classifyFailoverReason("402 Payment Required: Weekly/Monthly Limit Exhausted")).toBe(
647647
"billing",
648648
);
649+
// Poe returns 402 without "payment required"; must be recognized for fallback
650+
expect(
651+
classifyFailoverReason(
652+
"402 You've used up your points! Visit https://poe.com/api/keys to get more.",
653+
),
654+
).toBe("billing");
649655
expect(classifyFailoverReason(INSUFFICIENT_QUOTA_PAYLOAD)).toBe("billing");
650656
expect(classifyFailoverReason("deadline exceeded")).toBe("timeout");
651657
expect(classifyFailoverReason("request ended without sending any chunks")).toBe("timeout");

src/agents/pi-embedded-helpers/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ const RETRYABLE_402_SCOPED_RESULT_HINTS = [
237237
"exhausted",
238238
] as const;
239239
const RAW_402_MARKER_RE =
240-
/["']?(?: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 required\b/i;
240+
/["']?(?: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 required\b|^\s*402\s+.*used up your points\b/i;
241241
const LEADING_402_WRAPPER_RE =
242242
/^(?:error[:\s-]+)?(?:(?:http\s*)?402(?:\s+payment required)?|payment required)(?:[:\s-]+|$)/i;
243243

0 commit comments

Comments
 (0)