fix(opencode): retry xAI capacity stream errors (#43640)

Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot]
2026-08-20 09:29:30 -05:00
committed by GitHub
parent b155b15694
commit 71d08e94d5
4 changed files with 35 additions and 0 deletions
@@ -0,0 +1,24 @@
import { describe, expect, test } from "bun:test"
import { ProviderError } from "@/provider/error"
describe("provider stream errors", () => {
test("retries provider stream errors without a code", () => {
const messages = [
"The model is currently at capacity due to high demand. Please try again in a few minutes, or use a higher service tier for priority processing: https://docs.x.ai/developers/advanced-api-usage/priority-processing",
"The model is temporarily unavailable.",
]
for (const message of messages)
expect(
ProviderError.parseStreamError({
type: "error",
error: { message },
}),
).toEqual({
type: "api_error",
message,
isRetryable: true,
responseBody: JSON.stringify({ type: "error", error: { message } }),
})
})
})