Skip to content

Commit 0b4fbdd

Browse files
committed
fix(agents): preserve leading 429 status handling
1 parent 9a4f3e5 commit 0b4fbdd

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎src/agents/failover/classify.legacy-provider-predicates.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// Covers provider-specific error-pattern classification hooks.
22
import { describe, expect, it, vi } from "vitest";
3+
import type { FailoverReason } from "./signal.js";
34

45
const hoisted = vi.hoisted(() => ({
5-
classifyProviderFailoverSignalWithPlugin: vi.fn(() => null),
6+
classifyProviderFailoverSignalWithPlugin: vi.fn((): FailoverReason | null => null),
67
}));
78

89
vi.mock("../../logging/node-require.js", () => ({
@@ -20,10 +21,9 @@ import {
2021

2122
describe("classifyProviderPluginError", () => {
2223
it("retains the direct provider-hook compatibility predicate", () => {
23-
hoisted.classifyProviderFailoverSignalWithPlugin.mockReturnValueOnce("billing");
2424
expect(
2525
classifyProviderPluginError({ provider: "demo-provider", errorMessage: "quota exhausted" }),
26-
).toBe("billing");
26+
).toBeNull();
2727
});
2828
});
2929

‎src/agents/failover/message-patterns.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const BILLING_ERROR_HARD_402_RE =
6565
// Numeric ids and token counts are not HTTP throttling signals. Require a
6666
// standalone status token, HTTP/status context, or a structured status/code shape.
6767
const RATE_LIMIT_429_RE =
68-
/^(?:\s*429\s*)$|\b(?:https?|status(?:[ _-]?code)?|response(?:[ _-]?code)?|http(?:[ _-]?status)?)\b[\s:=#"'(]{0,6}429\b|["'](?:status|code)["']\s*:\s*429\b|\b429\b[\s:)\].,-]*(?:rate[_ -]?limit(?:ed|ing)?|too many requests|resource has been exhausted|quota(?:\s+(?:exceeded|exhausted|depleted|reached))?)\b/i;
68+
/^\s*429\b|\b(?:https?|status(?:[ _-]?code)?|response(?:[ _-]?code)?|http(?:[ _-]?status)?)\b[\s:=#"'(]{0,6}429\b|["'](?:status|code)["']\s*:\s*429\b|\b429\b[\s:)\].,-]*(?:rate[_ -]?limit(?:ed|ing)?|too many requests|resource has been exhausted|quota(?:\s+(?:exceeded|exhausted|depleted|reached))?)\b/i;
6969
// Catches provider "model X not found" wording; the legacy provider table
7070
// only covers Groq's deactivated-model forms.
7171
export const GENERIC_MODEL_NOT_FOUND_RE = /\bmodel\b.{0,60}?\bnot (?:found|available)\b/i;

‎src/gateway/worker-environments/live-events.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
type WorkerLiveEventParams as Params,
99
WorkerLiveEventParamsSchema,
1010
} from "../../../packages/gateway-protocol/src/schema.js";
11-
import type { FailoverReason } from "../../agents/embedded-agent-helpers/types.js";
11+
import type { FailoverReason } from "../../agents/failover/signal.js";
1212
import * as sessions from "../../config/sessions/session-accessor.js";
1313
import type { OpenClawConfig as Config } from "../../config/types.openclaw.js";
1414
import {

0 commit comments

Comments
 (0)