mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 14:40:20 +00:00
fix(auth): classify missing OAuth scopes as auth failures (#24761)
This commit is contained in:
@@ -393,6 +393,10 @@ describe("classifyFailoverReason", () => {
|
|||||||
expect(classifyFailoverReason("invalid api key")).toBe("auth");
|
expect(classifyFailoverReason("invalid api key")).toBe("auth");
|
||||||
expect(classifyFailoverReason("no credentials found")).toBe("auth");
|
expect(classifyFailoverReason("no credentials found")).toBe("auth");
|
||||||
expect(classifyFailoverReason("no api key found")).toBe("auth");
|
expect(classifyFailoverReason("no api key found")).toBe("auth");
|
||||||
|
expect(classifyFailoverReason("You have insufficient permissions for this operation.")).toBe(
|
||||||
|
"auth",
|
||||||
|
);
|
||||||
|
expect(classifyFailoverReason("Missing scopes: model.request")).toBe("auth");
|
||||||
expect(classifyFailoverReason("429 too many requests")).toBe("rate_limit");
|
expect(classifyFailoverReason("429 too many requests")).toBe("rate_limit");
|
||||||
expect(classifyFailoverReason("resource has been exhausted")).toBe("rate_limit");
|
expect(classifyFailoverReason("resource has been exhausted")).toBe("rate_limit");
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
@@ -655,6 +655,9 @@ const ERROR_PATTERNS = {
|
|||||||
"unauthorized",
|
"unauthorized",
|
||||||
"forbidden",
|
"forbidden",
|
||||||
"access denied",
|
"access denied",
|
||||||
|
"insufficient permissions",
|
||||||
|
"insufficient permission",
|
||||||
|
/missing scopes?:/i,
|
||||||
"expired",
|
"expired",
|
||||||
"token has expired",
|
"token has expired",
|
||||||
/\b401\b/,
|
/\b401\b/,
|
||||||
|
|||||||
Reference in New Issue
Block a user