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:
@@ -248,6 +248,28 @@ describe("model-error-classifier", () => {
|
|||||||
//#then
|
//#then
|
||||||
expect(result).toBe(true)
|
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 {}
|
export {}
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ const RETRYABLE_MESSAGE_PATTERNS = [
|
|||||||
"504",
|
"504",
|
||||||
"429",
|
"429",
|
||||||
"529",
|
"529",
|
||||||
"403",
|
"selected provider is forbidden",
|
||||||
"forbidden",
|
"provider is forbidden",
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user