Repository navigation
Conversation
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.
Problem
Streaming Claude and Bedrock responses replace malformed tool input JSON with an empty object and drop the decoder error. A tool call whose streamed input does not parse (for example a truncated
{"query": "x") reaches the host as a valid call with{}arguments and is executed with missing parameters.The OpenAI and OpenAI-compatible drivers already keep the original string in
argumentsandraw_argumentsand report the decoder diagnostic inarguments_error(#196); the README documents that contract for all tool calls, and hosts reject calls carryingarguments_error.Cause
claude/client.luaandbedrock/client.luadecode the accumulatedinput_json_delta/toolUse.inputtext at block stop and fall back to{}on a decode error.claude/mapper.luaandbedrock/mapper.luamap_tool_callscopy onlyid,nameandarguments, so the diagnostic fields could not reach the response either way.Fix
wippy.llm.util:tool_argumentslibrary holds the single decode rule for provider argument text: valid JSON yields the decoded value, malformed text stays inargumentsandraw_argumentswith the decoder error inarguments_error.raw_argumentsandarguments_erroronto the contract tool call.{}, which is how both APIs stream a call with empty input.Non-streaming Claude and Bedrock responses deliver tool input as a decoded object and are unchanged. Google delivers function call arguments as objects and has no decode step.
Tests
claude/client_test: malformed streamed input keeps the raw text and decoder error; empty input stays{}without diagnostics.bedrock/client_test: malformed streamed input keeps the raw text and decoder error; valid input split across deltas decodes without diagnostics.claude/mapper_test,bedrock/mapper_test: streaming response formatting carries both fields onto the contract tool call.The malformed-input and mapper cases fail before the change.
make testinsrc/llm/test: 2920 passed, 9 skipped.make lint: no issues.