Fix duplictate tool call processing in Chutes, DeepInfra, LiteLLM and xAI providers - #4620
Conversation
🦋 Changeset detectedLatest commit: ae6818b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
✅ No Issues Found
6 files reviewed | Confidence: 95% | Recommendation: Merge
Review Details
Files:
.changeset/petite-moose-wish.md- Changeset filesrc/api/providers/base-openai-compatible-provider.ts- Removed unused importsrc/api/providers/chutes.ts- Removed duplicate tool call processingsrc/api/providers/deepinfra.ts- Removed duplicate tool call processingsrc/api/providers/lite-llm.ts- Removed duplicate tool call processingsrc/api/providers/xai.ts- Removed duplicate tool call processing
Analysis:
This PR correctly fixes duplicate tool call processing. The issue was that these providers were using both:
ToolCallAccumulator.processChunk()- which yieldstool_callevents whenfinish_reason === "tool_calls"- Direct
tool_call_partialyielding - which emits partial chunks forNativeToolCallParser
This caused duplicate tool call events. The fix removes ToolCallAccumulator usage while keeping the tool_call_partial yielding, which is the correct approach since:
NativeToolCallParser.processRawChunk()handles the partial chunksNativeToolCallParser.processFinishReason()handles emittingtool_call_endevents- The
base-openai-compatible-provider.tsalready uses this pattern correctly (yieldstool_call_partialwithoutToolCallAccumulator)
Checked: Security, bugs, duplicate processing, consistency with existing patterns
| } | ||
|
|
||
| // kilocode_change start | ||
| // GPT-5 models require max_completion_tokens instead of the deprecated max_tokens parameter |
There was a problem hiding this comment.
I suppose comments should not have kilocode_change markers?
There was a problem hiding this comment.
this is actually how it is upstream
No description provided.