Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(cloud): the non-streamed runaway answers 422, so no retry rule is needed

purple87b7b4f61d6a
diff --git a/src/api/providers/__tests__/stream-error-keeps-its-code.test.ts b/src/api/providers/__tests__/stream-error-keeps-its-code.test.ts
index 1aa30e0a..c580e3ec 100644
--- a/src/api/providers/__tests__/stream-error-keeps-its-code.test.ts
+++ b/src/api/providers/__tests__/stream-error-keeps-its-code.test.ts
@@ -75,7 +75,8 @@ describe('a request without streaming that LU Cloud ended as a runaway', () => {
calls.push(url)
return new Response(
JSON.stringify({ error: 'The model produced no visible output for 10 minutes, so this step was ended.', code: 'stalled_runaway' }),
- { status: 504, headers: { 'Content-Type': 'application/json' } },
+ // 422: the server answers a runaway with a 4xx so no app version retries it.
+ { status: 422, headers: { 'Content-Type': 'application/json' } },
)
}),
)
diff --git a/src/api/providers/__tests__/transient-retry.test.ts b/src/api/providers/__tests__/transient-retry.test.ts
index 92ca6750..8709e334 100644
--- a/src/api/providers/__tests__/transient-retry.test.ts
+++ b/src/api/providers/__tests__/transient-retry.test.ts
@@ -128,19 +128,6 @@ describe('sendWithTransientRetry', () => {
expect(await out.text()).toContain('flash_timeout')
})
- it('does not retry a stalled_runaway, a request LU Cloud ended after ten silent minutes', async () => {
- const clock = recorder()
- const send = vi.fn().mockResolvedValue(
- res(504, JSON.stringify({ error: 'The model produced no visible output for 10 minutes, so this step was ended.', code: 'stalled_runaway' })),
- )
-
- const out = await sendWithTransientRetry(send, { wait: clock.wait })
-
- expect(send).toHaveBeenCalledTimes(1)
- expect(clock.waited).toEqual([])
- expect(await out.text()).toContain('stalled_runaway')
- })
-
it('NEGATIVE CONTROL: a 504 without flash_timeout is still retried', async () => {
const clock = recorder()
const send = vi.fn().mockResolvedValue(res(504, 'bad gateway'))
diff --git a/src/api/providers/retry.ts b/src/api/providers/retry.ts
index cfd9d861..14c6576e 100644
--- a/src/api/providers/retry.ts
+++ b/src/api/providers/retry.ts
@@ -84,12 +84,10 @@ async function isPermanent429(res: Response): Promise<boolean> {
* `isPermanent429` above, not a transient gateway hiccup a second attempt
* could fix.
*/
-async function isPermanentTimeout(res: Response): Promise<boolean> {
+async function isPermanentFlashTimeout(res: Response): Promise<boolean> {
if (res.status !== 504) return false
try {
- // stalled_runaway (30.09.2026): a request without streaming that produced
- // nothing for ten minutes, ended by the server. Again = ten more minutes.
- return /flash_timeout|stalled_runaway/.test(await res.clone().text())
+ return /flash_timeout/.test(await res.clone().text())
} catch {
return false
}
@@ -124,7 +122,7 @@ export async function sendWithTransientRetry(
if (!TRANSIENT_STATUS.has(res.status)) return res
if (opts?.signal?.aborted) return res
if (await isPermanent429(res)) return res
- if (await isPermanentTimeout(res)) return res
+ if (await isPermanentFlashTimeout(res)) return res
// The server's own number wins — a fixed-window limiter refuses again for
// the whole window, so guessing shorter just burns an attempt inside it.