fix(copilot): handle chat tool call ids#22612
Open
eigenpat wants to merge 3 commits intoanomalyco:devfrom
Open
fix(copilot): handle chat tool call ids#22612eigenpat wants to merge 3 commits intoanomalyco:devfrom
eigenpat wants to merge 3 commits intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Thanks this works for me |
10 tasks
|
Bump. This needs to be merged its a good fix |
Collaborator
|
No this is not a good or correct fix, you are editing files specifically for the github copilot provider, Why? you definitely arent using that... that doesnt make sense copilot doesnt even host this model. |
Handle non-compliant chat completion responses that return numeric tool call IDs so NVIDIA NIM and similar OpenAI-compatible providers can continue through tool-call parsing.
d5b9768 to
3743129
Compare
Author
|
Reworked this PR so it no longer touches the GitHub Copilot-specific fork. The fix now lives in the generic |
Normalize tool call IDs in the Copilot chat runtime so OpenAI-compatible providers keep working when they send numeric IDs or omit the initial streamed ID chunk.
6 tasks
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.
Issue for this PR
Closes #19947
Type of change
What does this PR do?
Kimi/NVIDIA tool calls in opencode are not going through the generic
@ai-sdk/openai-compatibleruntime path frompackages/opencode/src/provider/provider.ts. They go through the Copilot OpenAI-compatible chat runtime inpackages/opencode/src/provider/sdk/copilot/chat/openai-compatible-chat-language-model.ts.The original PR had the right normalization idea, but it fixed the wrong runtime path for this bug. The failing path was still throwing
Expected 'id' to be a string.whentool_calls[].idarrived as a number or when the first streamed tool-call chunk omittedid.This update fixes the actual runtime path by:
tool_calls[].idvalues to strings in the Copilot chat pathidHow did you verify your code works?
bun test test/provider/copilot/copilot-chat-model.test.tsfrompackages/opencodebun typecheckfrompackages/opencodebun run buildfrompackages/opencodeScreenshots / recordings
N/A - backend provider compatibility fix.
Checklist