Repository navigation
Conversation
Chat-with-tools requests broke with a 400 "Provider returned error" on
providers that validate the request strictly (Groq via OpenRouter serving
openai/gpt-oss-120b: "'messages.3' : for 'role:tool' the following must
be satisfied [('messages.3.name' : Value is not nullable)]"). Two sites
sent role:tool messages in a shape such validators reject:
- requestChatCompletion passed the current-turn tool results through
with the incoming "name": null. Groq's schema makes name optional but
non-nullable, so an explicit null fails validation.
- the history loop passed role:tool entries through with no name and no
tool_call_id at all, while Groq requires tool_call_id on every tool
message.
Resolve the function name of each tool result from the assistant
tool_calls already present in the conversation (falling back to a
generic name when the id cannot be matched) and complete history tool
entries with the name and tool_call_id of the assistant call they
answer. The corrected request was verified accepted by a live Groq
backend through OpenRouter: the model responded with a tool call.
Assisted-by: opencode (zai/glm-5.3)
Signed-off-by: WSHAPER <42714629+WSHAPER@users.noreply.github.com>
The tool message contract is a single message object (see the parameter documentation and the chat-with-tools task input), but the name completion iterated the decoded value as a list. Iterating a bare object yields its field values, so the first loop pass received the role field's string and the array access on it raised a TypeError. The decoded value is now normalized to a list, so the single-object contract works and a list stays accepted defensively. Assisted-by: opencode (zai/glm-5.3) Signed-off-by: WSHAPER <42714629+WSHAPER@users.noreply.github.com>
This branch has not been deployed
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.
Fixes #456
🤖 AI (if applicable)