[Bug]: OpenAIVLM ignores the configured stream flag — SSE/streaming providers broken; 11 unit tests fail on main
Bug Description
The stream config flag for the OpenAI-compatible VLM provider is accepted by VLMConfig/VLMBase (self.stream = config.get("stream", False) in openviking/models/vlm/base.py:78) and documented as supported, but OpenAIVLM no longer honors it. As a result, requests to providers that require/return SSE streaming (where the OpenAI SDK needs stream=true to parse the response) are broken, and token usage is not extracted from streaming chunks.
This is a regression introduced by PR #1711 ("Feat/memory isolation 支持群聊模式"), which removed:
_extract_from_chunk()_process_streaming_response()/_process_streaming_response_async()- the
"stream": self.streamkwarg from_build_text_kwargs()and_build_vision_kwargs() - the
if self.stream:branch in_extract_completion_content()/_extract_completion_content_async()
…while the base class, VLMConfig migration, configuration docs, the changelog ("OpenAI VLM streaming"), and the codex_vlm backend (which still reads self.stream) all still treat streaming as a supported feature.
Evidence
The committed test suite tests/unit/test_stream_config_vlm.py encodes the contract and has 11 failures on current main (674f5e60), e.g.:
FAILED tests/unit/test_stream_config_vlm.py::TestVLMStreamConfig::test_stream_false_by_default
FAILED ...::test_stream_true_passed_to_api
FAILED ...::test_stream_false_uses_non_streaming_path
FAILED ...::test_async_stream_true
FAILED ...::test_vision_completion_stream_true
FAILED ...::TestStreamingResponseProcessing::test_process_streaming_response_with_content
...
Root failure: _build_text_kwargs() does not put stream in the API kwargs, so call_kwargs.get("stream") is None instead of False/True, and get_completion() tries to parse a chunk iterator as a non-streaming response.
Steps to Reproduce
PYTHONPATH=. .venv/bin/python -m pytest -q tests/unit/test_stream_config_vlm.py --no-cov
# 11 failed, 9 passed
Expected Behavior
stream: false(default) sendsstream=falseand uses the non-streaming response path (unchanged).stream: truesendsstream=true, concatenateschoices[0].delta.contentchunks, and records token usage from the final chunkusage.get_completion_async,get_vision_completion, andget_vision_completion_asyncbehave the same.
Impact
- Documented configuration
vlm.stream/ per-credentialproviders.<name>.streamis silently ignored. - OpenAI-compatible gateways that force SSE responses cannot be used (the docs explicitly call this out: "OpenAI SDK 需要
stream=true才能正确解析 SSE 响应"). - 11 unit tests are red on main.
Proposed Fix
Restore streaming support in openviking/models/vlm/backends/openai_vlm.py:
- Re-add
_extract_from_chunk(),_process_streaming_response(), and_process_streaming_response_async(). - Add
"stream": self.streamto_build_vision_kwargs(), and to_build_text_kwargs()for non-tool calls (tool calls require the structured non-streaming message, so they correctly remain non-streaming). - Branch
_extract_completion_content()/_extract_completion_content_async()onself.stream.
This makes all 20 tests in tests/unit/test_stream_config_vlm.py pass with no production behavior change for the default stream=false path.
Environment
- OpenViking: current
main@ 674f5e60 - Backend: N/A (unit-test verified; also affects OpenAI-compatible SSE providers)
- Introduced by: #1711
Update: after posting this I found the earlier draft implementations in #3406, #3756, and #3863. To avoid opening a fourth overlapping implementation, I am stepping back from #3755 and will not submit a PR here. Sorry for the noise.
Status update for future readers: current main resolves this by explicitly rejecting the flag rather than restoring streaming — VLMConfig now raises on stream (and on extra_request_body.stream) with "stream is not supported; OpenViking VLM calls return complete responses" (openviking_cli/utils/config/vlm_config.py, _reject_stream_config), and the OpenAI VLM backend no longer reads a stream mode at all. The earlier draft implementations (#3406/#3756/#3863) were all closed without merging.
So the regression described here is now a deliberate product decision: OpenViking's VLM surface is completion-only. If a provider genuinely requires SSE to return anything, that's a new feature request (a supported streaming path with chunk aggregation), not a reopening of this bug. Suggest closing this issue as resolved-by-rejection — happy to convert it into a feature-request writeup if maintainers want to keep tracking the "SSE-only provider" case.
+1 to closing as resolved-by-rejection per @now-ing — completion-only VLM is the current product decision on main; SSE-only providers would be a separate feature request.
Thanks for reporting this! #4541 resolves the silent configuration mismatch by explicitly rejecting stream, including extra_request_body.stream, instead of accepting it and quietly returning a non-streaming response. The current VLM contract is complete responses; remove these stream settings and use a provider endpoint that supports non-streaming requests.
Closing the ignored-configuration bug as resolved on main. This does not mean SSE-only providers are now supported; the separate streaming feature request is tracked in #5020.
If a version containing #4541 still silently accepts a stream setting, or a supported non-streaming request fails, please reopen, or comment requesting reopening, with the version, sanitized VLM configuration and error.