Skip to content

fix(provider): add missing index field to streaming tool_call deltas (#6661)#1

Merged
Yaohua-Leo merged 1 commit intomasterfrom
fix/6661-streaming-tool-call-index
Mar 20, 2026
Merged

fix(provider): add missing index field to streaming tool_call deltas (#6661)#1
Yaohua-Leo merged 1 commit intomasterfrom
fix/6661-streaming-tool-call-index

Conversation

@Yaohua-Leo
Copy link
Copy Markdown
Owner

Summary

Fixes AstrBotDevs#6661 - Streaming tool_call arguments lost when OpenAI-compatible proxy omits index field (e.g. Gemini)

Changes

  • Add missing index field to tool_call deltas before passing to ChatCompletionStreamState.handle_chunk()
  • Gemini and some OpenAI-compatible proxies (e.g. Continue) omit the index field
  • This caused handle_chunk() to reject the chunk and silently drop tool_call arguments

Testing

✅ Docker sandbox test passed

  • Tool call without index: index=0 assigned
  • Tool call with existing index: original value preserved
  • Empty tool_calls handled
  • Empty choices handled

- Fix AstrBotDevs#6661: Streaming tool_call arguments lost when OpenAI-compatible proxy omits index field
- Gemini and some proxies (e.g. Continue) don't include index field in tool_call deltas
- Add default index=0 when missing to prevent ChatCompletionStreamState.handle_chunk() from rejecting chunks

Fixes AstrBotDevs#6661
@Yaohua-Leo Yaohua-Leo merged commit f9506ec into master Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming tool_call arguments lost when OpenAI-compatible proxy omits index field (e.g. Gemini)

1 participant