Commits
Click on a commit to change the comparison rangefix(core): merge tool_call_chunks without index in streaming
Fixes #34654
When using agent.stream() with stream_mode=["messages"], tool_call_chunks
with index=None were not merging correctly, creating multiple partial
tool_calls with empty names that caused 422 errors from OpenAI API.
Modified merge_lists() to handle tool_call_chunks without valid index by:
- Merging chunks with same non-empty id when continuation (empty name)
- Sequential merging for chunks with empty ids (streaming fragments)
- Preserving existing behavior for chunks with valid index
Added comprehensive unit tests covering edge cases including multiple
tool calls, interleaved chunks, and sequential streaming scenarios.
All existing tests pass without regression.