Repository navigation
fix: keep real stream metadata after an empty Azure filter chunk - #1508
Conversation
Azure OpenAI streams a prompt-filter chunk first with id, object and model set to "" and created set to 0. The chat streaming collector kept the first value it saw, so the assembled response had an empty model and id. Skip empty values so the first real ones are kept. Signed-off-by: Somay-kousis <[email protected]>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Capture valid stream metadata crates/core/src/codec/openai_chat.rs, crates/core/tests/unit/codec/openai_chat_tests.rs |
observe ignores empty metadata strings and created: 0 when capturing values. The test checks that later chunks provide the assembled response metadata and content. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk: 
Minimal · up to 076f1
-
The change appears ready to merge after normal checks; no outstanding issue is identified.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title follows Conventional Commits with the allowed type 'fix', lowercase type, no scope, imperative summary, no trailing period, and is 64 characters, under the 72-character limit. It accurately describes the change: skipping empty Azure prompt-filter metadata so real stream metadata is kept.
Full details: Description check
-
Explanation
The description follows the repository template. It includes the Overview with both checklist items checked, Details explaining the change to OpenAIChatStreamingState::observe and the validation run, Where should the reviewer start pointing to the file and function, and Related Issues with 'Closes
#1506'. The 'Not run' note on pre-commit and binding suites adds useful context.
Full details: Linked Issues check
-
Explanation
Issue
#1506requires the streaming OpenAI chat codec to retain the first non-emptyid,object,model, and non-zerocreatedvalue.OpenAIChatStreamingState::observenow skips empty strings andcreated: 0. The added Azure prompt-filter test verifies later metadata,gpt-4o-mini, and message"hi". The reported codec tests pass.
Full details: Out of Scope Changes check
-
Explanation
The reported changes are limited to
OpenAIChatStreamingState::observeand a focused codec regression test. Both changes support issue#1506. No unrelated production behavior or binding surface change is identified.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
/ok to test 076f16f |
Overview
Streaming chat completions from Azure OpenAI now keep the real
id,object,createdandmodelinstead of the empty values from Azure's leading prompt-filter chunk.Details
OpenAIChatStreamingState::observekeeps the first value it sees for each top-level field. It now skips""andcreated: 0, so the first real values win. Nothing changes for streams that never send empty values.Validation:
openai_chat_streaming_codec_skips_empty_metadata_from_azure_filter_chunkfails onmain(idis"") and passes here.cargo nextest run -p nemo-relay --lib -E 'test(codec::)': 655 passed.cargo nextest run -p nemo-relay-adaptive -E 'test(openai) | test(anthropic)': 103 passed.cargo fmt --checkandcargo clippy -p nemo-relay --all-targets -- -D warnings: clean.Not run:
uv run pre-commit run, binding suites (no binding surface changes).Where should the reviewer start?
crates/core/src/codec/openai_chat.rs,OpenAIChatStreamingState::observe.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit