Skip to content

fix: correlate id-less parallel tool-call fragments by stream index - #13278

Open
ege-arhan wants to merge 3 commits into
continuedev:mainfrom
ege-arhan:fix/issue-13223
Open

fix: correlate id-less parallel tool-call fragments by stream index#13278
ege-arhan wants to merge 3 commits into
continuedev:mainfrom
ege-arhan:fix/issue-13223

Conversation

@ege-arhan

Copy link
Copy Markdown

Problem

OpenAI streamed tool-call deltas carry a stable index, while id is optional on continuation fragments. Continue's fromChatCompletionChunk() dropped tool_call.index, and applyToolCallDelta() fell back to updating the most recently tracked tool call whenever a fragment had no id. With two parallel tool calls whose argument fragments interleave, one call's arguments were applied to the other call.

Fixes #13223.

Solution

  • Preserve tool_call.index through ToolCallDelta (new optional index?: number on the type + converter passthrough).
  • In applyToolCallDelta(), when a delta has no id but has an index, match the existing tool-call state by stream position instead of "last array element".
  • Existing id-based correlation stays first choice; the positional fallback remains for providers supplying neither field.

Impact

  • Parallel tool-call streaming attributes argument fragments to the correct call.
  • Single-call streaming behavior unchanged (id path and last-element fallback untouched).
  • Affects OpenAI/OpenAI-compatible provider stream path only.

Evidence

  • New regression test in core/llm/openaiTypeConverters.test.ts asserting index survives fromChatCompletionChunk().
  • Standalone repro of the issue's 4-delta sequence (index=0/id=call_A, index=1/id=call_B, index=0 id-less, index=1 id-less): after fix, call_A args = '{"target":"A_ONLY"}', call_B args = '{"target":"B_ONLY"}' (PASS).
  • Full npm install in this sandbox failed on /tmp disk quota (chromium-bidi tar write), so the repo vitest suite could not run here; test added for CI.

Fixes #13223

@ege-arhan
ege-arhan requested a review from a team as a code owner September 14, 2026 13:13
@ege-arhan
ege-arhan requested review from sestinj and removed request for a team September 14, 2026 13:13
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@ege-arhan

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

2 similar comments
@ege-arhan

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@ege-arhan

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@ege-arhan

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@ege-arhan

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

OpenAI parallel tool-call argument fragments can be applied to the wrong call

1 participant