fix: treat OAuth refresh failures as auth errors (#1261) (thanks @zknicker)

Co-authored-by: Zach Knickerbocker <zknicker@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-01-20 09:31:24 +00:00
parent 94af5a72fc
commit aedf4ce328
3 changed files with 12 additions and 0 deletions

View File

@@ -19,6 +19,15 @@ describe("isAuthErrorMessage", () => {
expect(isAuthErrorMessage(sample)).toBe(true);
}
});
it("matches OAuth refresh failures", () => {
const samples = [
"OAuth token refresh failed for anthropic: Failed to refresh OAuth token for anthropic. Please try again or re-authenticate.",
"Please re-authenticate to continue.",
];
for (const sample of samples) {
expect(isAuthErrorMessage(sample)).toBe(true);
}
});
it("ignores unrelated errors", () => {
expect(isAuthErrorMessage("rate limit exceeded")).toBe(false);
expect(isAuthErrorMessage("billing issue detected")).toBe(false);

View File

@@ -328,6 +328,8 @@ const ERROR_PATTERNS = {
"incorrect api key",
"invalid token",
"authentication",
"re-authenticate",
"oauth token refresh failed",
"unauthorized",
"forbidden",
"access denied",