OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: Async Codex Responses adapter is capped by the default thread pool, not vlm.max_concurrent

Open ragnos-dev opened this issue 2 weeks ago • 1 comments

Version

OpenViking v0.5.4 (9dfa9017a). The same code is on current main (checked 2026-11-13).

Summary

The async Codex Responses adapter (openviking/models/vlm/backends/codex_responses_adapter.py, used by codex_vlm.py) runs each streamed call with asyncio.to_thread, and a streamed call holds its thread for the whole response. The default executor has min(32, cpu_count + 4) threads, so on an 8-CPU host at most 12 calls run at once whatever vlm.max_concurrent says, and those calls starve every other to_thread user in the server.

Reproduction

Set vlm.max_concurrent to 32 and drive the async adapter with a fake blocking call. In-flight calls stop at the default executor size.

Proposed fix

Give each async adapter its own bounded ThreadPoolExecutor sized from vlm.max_concurrent (clamped to 1..32), run calls on it with the caller's context copied (as to_thread does), and shut it down on close.

We run a local patch that does this and are happy to open a PR.

ragnos-dev avatar Nov 13 '26 14:11 ragnos-dev

Thanks for reporting this.

We do not recommend or support caller-requested streaming for the openai-codex VLM backend: passing stream=True to the adapter is explicitly rejected. The stream mentioned here is internal: ordinary completion requests consume a Responses stream and return a single completed response. This does not require the caller to enable streaming.

The reproduction provided uses a fake blocking adapter call. Could you share the actual OpenViking operation/API, VLM configuration (without credentials), and measurements showing this limit or interference with other work during normal usage? vlm.max_concurrent is an upper bound, not a guarantee that this many calls execute concurrently.

We are not planning to introduce the proposed per-adapter thread pool, so we are closing this as not planned.

qin-ctx avatar Nov 16 '26 12:11 qin-ctx