Fix parallel tool calls shared index#2
Open
baya wants to merge 4 commits into
Open
Conversation
…current call
Some OpenAI-compat gateways (observed: an Anthropic-to-OpenAI translation
gateway) emit argument-continuation chunks carrying no index, no id, and
no function.name. The accumulator's lookup missed on both maps and
created a phantom ToolCall block, so the argument deltas landed on the
phantom while the real call finalized with empty arguments {} and failed
tool schema validation downstream.
Track the last-touched tool-call block on the stream processor and fall
back to it when a delta identifies itself in no other way; creating a
new block remains the final fallback for a genuinely new call.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
std::env::temp_dir() returns a /var/... path that is a symlink to /private/var/..., while the shell reports the resolved path in $PWD. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…l-call-deltas fix(openai-completions): route bare tool-call argument deltas to the current call
…index 0
Live capture from an Anthropic-to-OpenAI translation gateway shows
parallel tool calls are not renumbered: every call arrives with index 0,
distinguished only by its fresh id+name header chunk. Keying the
accumulator by index alone concatenated call B's arguments onto call A
('{...}{...}'), the JSON parse failed, and BOTH calls finalized with
empty arguments {} — downstream tool validation then rejected them
(read_file/run_shell with missing required fields).
Treat a header chunk (non-empty id AND name) whose id conflicts with the
block mapped at that index as a new tool call and remap the index to it.
The name requirement keeps streams whose continuation chunks carry
rotating junk ids but never a name (e.g. kimi) coalescing by stable
index exactly as before.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.