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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(cloud): a request LU Cloud ended as a runaway is not sent again, streamed or not
purple911cb2d5b641
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.tsindex e1440cce..1aa30e0a 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@@ -64,3 +64,31 @@ describe('a stream error chunk keeps its code', () => {expect(isTerminalModelError(err)).toBe(false)})})++describe('a request without streaming that LU Cloud ended as a runaway', () => {+ it('is sent once, thrown with its code, and terminal', async () => {+ vi.resetModules()+ const calls: string[] = []+ vi.doMock('../../backend', () =>+ backendMock((url) => {+ if (!url.includes('/chat/completions')) return new Response('{}', { status: 404 })+ 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' } },+ )+ }),+ )+ const { OpenAIProvider } = await import('../openai-provider')+ const p = new OpenAIProvider({+ id: 'openai', name: 'LU Cloud', enabled: true, apiKey: 'x', baseUrl: 'https://lu-labs.test/api/inference/v1', isLocal: false,+ })+ const err = await p.chatWithTools('google/gemma-4-26B-A4B-it', [{ role: 'user', content: 'go' }], []).then(+ () => { throw new Error('did not throw') },+ (e: unknown) => e,+ )+ expect(calls).toHaveLength(1)+ expect((err as { code?: string }).code).toBe('stalled_runaway')+ expect(isTerminalModelError(err)).toBe(true)+ })+})diff --git a/src/api/providers/__tests__/transient-retry.test.ts b/src/api/providers/__tests__/transient-retry.test.tsindex 8709e334..92ca6750 100644--- a/src/api/providers/__tests__/transient-retry.test.ts+++ b/src/api/providers/__tests__/transient-retry.test.ts@@ -128,6 +128,19 @@ 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/openai-provider.ts b/src/api/providers/openai-provider.tsindex db8938b6..3c6fe3d4 100644--- a/src/api/providers/openai-provider.ts+++ b/src/api/providers/openai-provider.ts@@ -1760,6 +1760,9 @@ export class OpenAIProvider implements ProviderClient {// honest, user-facing `error` line (already captured as `message`).if (serverCode === 'model_no_tools') code = 'tools_unsupported'else if (serverCode === 'model_no_vision') code = 'vision_unsupported'+ // A request without streaming that LU Cloud ended after ten minutes with+ // nothing to show; lib/http-status treats it as terminal.+ else if (serverCode === 'stalled_runaway') code = 'stalled_runaway'else if (serverCode === 'credits_exhausted') {// Out of credits, top-up wallet empty (HTTP 429). Raise the global// signal so the "Load up your credits" dialog opens on top of thediff --git a/src/api/providers/retry.ts b/src/api/providers/retry.tsindex 14c6576e..cfd9d861 100644--- a/src/api/providers/retry.ts+++ b/src/api/providers/retry.ts@@ -84,10 +84,12 @@ async function isPermanent429(res: Response): Promise<boolean> {* `isPermanent429` above, not a transient gateway hiccup a second attempt* could fix.*/-async function isPermanentFlashTimeout(res: Response): Promise<boolean> {+async function isPermanentTimeout(res: Response): Promise<boolean> {if (res.status !== 504) return falsetry {- return /flash_timeout/.test(await res.clone().text())+ // 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())} catch {return false}@@ -122,7 +124,7 @@ export async function sendWithTransientRetry(if (!TRANSIENT_STATUS.has(res.status)) return resif (opts?.signal?.aborted) return resif (await isPermanent429(res)) return res- if (await isPermanentFlashTimeout(res)) return res+ if (await isPermanentTimeout(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.