Skip to content

Fix duplictate tool call processing in Chutes, DeepInfra, LiteLLM and xAI providers - #4620

Merged
chrarnoldus merged 1 commit into
mainfrom
christiaan/duplicate-tools
Dec 22, 2025
Merged

Fix duplictate tool call processing in Chutes, DeepInfra, LiteLLM and xAI providers#4620
chrarnoldus merged 1 commit into
mainfrom
christiaan/duplicate-tools

Conversation

@chrarnoldus

Copy link
Copy Markdown
Collaborator

No description provided.

@changeset-bot

changeset-bot Bot commented Dec 22, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ae6818b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

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

@kilo-code-bot kilo-code-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No Issues Found

6 files reviewed | Confidence: 95% | Recommendation: Merge

Review Details

Files:

  • .changeset/petite-moose-wish.md - Changeset file
  • src/api/providers/base-openai-compatible-provider.ts - Removed unused import
  • src/api/providers/chutes.ts - Removed duplicate tool call processing
  • src/api/providers/deepinfra.ts - Removed duplicate tool call processing
  • src/api/providers/lite-llm.ts - Removed duplicate tool call processing
  • src/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:

  1. ToolCallAccumulator.processChunk() - which yields tool_call events when finish_reason === "tool_calls"
  2. Direct tool_call_partial yielding - which emits partial chunks for NativeToolCallParser

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 chunks
  • NativeToolCallParser.processFinishReason() handles emitting tool_call_end events
  • The base-openai-compatible-provider.ts already uses this pattern correctly (yields tool_call_partial without ToolCallAccumulator)

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose comments should not have kilocode_change markers?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually how it is upstream

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.

2 participants