fix(model-error-classifier): scope forbidden-provider retry to specific phrase

Bare "403" and "forbidden" substring patterns (added in 034744cb to
retry the "Selected provider is forbidden" case from PR #3706) matched
any error message containing those tokens — tool-level 403s, file-perm
"forbidden" messages, unrelated upstream errors that happened to spell
"forbidden". The legacy model-fallback path then armed setPendingModelFallback
on those unrelated errors, jumping Sisyphus to claude-opus-4-7 (first
entry of its fallback chain) regardless of the user's configured model.

Replace the bare patterns with the specific phrases PR #3706 actually
targeted, and add regression tests asserting unrelated 403/forbidden
messages stay non-retryable.

Reported-by: ilove_borshch on Discord (#omo-help)
This commit is contained in:
YeonGyu-Kim
2026-05-01 01:25:01 +09:00
parent a663562dbe
commit f7270a0f97
2 changed files with 24 additions and 2 deletions
+22
View File
@@ -248,6 +248,28 @@ describe("model-error-classifier", () => {
//#then
expect(result).toBe(true)
})
test("does not treat unrelated forbidden messages as retryable", () => {
//#given
const error = { message: "EACCES: forbidden write to /etc/hosts" }
//#when
const result = shouldRetryError(error)
//#then
expect(result).toBe(false)
})
test("does not treat unrelated 403 messages as retryable", () => {
//#given
const error = { message: "Tool returned HTTP 403 for the requested URL" }
//#when
const result = shouldRetryError(error)
//#then
expect(result).toBe(false)
})
})
export {}