Skip to content

BodyTimeout causes local models with long prompt load times to be unusableΒ #6570

@pwilkin

Description

@pwilkin

App Version

3.25.5

API Provider

OpenAI Compatible

Model Used

Qwen3-Coder-30B-A3B

Roo Code Task Links (Optional)

No response

πŸ” Steps to Reproduce

  1. Open RooCode on the Roo repository
  2. Pass it two big files (like Task.ts and ClineProvider.ts)
  3. Ask it to analyze the files in any way

πŸ’₯ Outcome Summary

On a slow model, after 5 minutes the connection will get terminated due to
(a) OpenAI using fetch under the hood
(b) fetch using undici under the hood
(c) undici having a separate bodyTimeout which defaults to 5 minutes (300s)

This becomes especially annoying when coupled with context condensing (which makes i.e. llama.cpp unable to use prompt caching).

Preferrably, if a timeout parameter could be added to the provider, then something like this could possibly work:

import { fetch as undiciFetch } from 'undici';

function customFetch(input: RequestInfo | URL, init?: RequestInit) {
	// Convert the standard fetch parameters to Undici format
	const undiciOptions = {
		...init,
		bodyTimeout: 180000
	}
	
	// Type assertion to handle the compatibility issue
	return undiciFetch(input as any, undiciOptions as any) as any
}

and then:

			this.client = new OpenAI({
				baseURL,
				apiKey,
				defaultHeaders: headers,
				timeout: 180000,
				// Use customFetch to inject Undici's extended options like bodyTimeout
				fetch: customFetch
			})

(with the configured timeout instead of 30 minutes)

πŸ“„ Relevant Logs or Errors (Optional)

terminated

Retry attempt 1
Retrying now...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - Needs ScopingValid, but needs effort estimate or design input before work can start.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions