Repository navigation
Conversation
…s as written Tool call arguments decode with json.decode_with_nulls, so a null argument reaches the tool as json.null. Providers that return arguments as objects take them from a null-preserving decode of the response. Google sends a json.raw tool schema through parametersJsonSchema.
skhaz
approved these changes
Nov 15, 2026
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.
Depends on wippyai/runtime#1088 (
json.null,json.decode_with_nulls,json.raw). Do not merge before a runtime release that includes it: on an older runtimejson.decode_with_nullsdoes not exist and every tool call decode fails.Defect
{"q": null, "r": 1}reaches the tool as{r = 1}. The tool cannot tell "the model set q to null" from "the model left q out".Cause
json.decode, which drops null members: OpenAI and OpenAI-compatibleargumentsstrings, streamed Claude and Bedrock input JSON, and the history mappers that decode a storedfunction_call.argumentsstring before resending it (Claude, Bedrock, Google).google_mapper.map_toolspasses every schema throughfilter_tool_schema, which mutates a table.Fix
json.decode_with_nulls. A null argument reaches the tool asjson.null, and a resent assistant tool call carriesnullagain.content[i].input,output.message.content[i].toolUse.input,candidates[c].content.parts[p].functionCall.args) from ajson.decode_with_nullsdecode of the same body or stream event. Decoding the whole response with nulls is not an option: envelope fields such as Claude'sstop_sequenceand text blockcitationsare null in normal responses, and as truthyjson.nullthey would break everyif field thenandfield or defaultread. The second decode runs only for responses that contain tool calls.json.rawschema is a JSON value the encoder writes as is, so the OpenAI, OpenAI-compatible, Claude and Bedrock mappers send it with its property order without change. Google sends ajson.rawschema asparametersJsonSchema(JSON Schema, accepted as written) and keeps the filteredparameterspath for table schemas, since a raw value cannot be filtered without decoding it and losing the order.structured_failure_contract_testpins the source line of the Google mapper's "Invalid Google response structure" error; the expected line moves from 395 to 400 with themap_toolschange.Tests
New cases in the existing driver suites (16):
openai/mapper_test,openai_compat/mapper_test: "keeps null tool call arguments as json.null", "sends a json.raw tool schema with its property order".claude/mapper_test,bedrock/mapper_test: "resends null tool call arguments as null", "sends a json.raw tool schema with its property order".google/mapper_test: "resends null tool call arguments as null", "sends a json.raw tool schema as parametersJsonSchema with its property order".claude/client_test: "keeps null members of a streamed tool input as json.null", "keeps null members of a tool input as json.null and leaves envelope nulls absent".bedrock/client_test: "keeps null members of a streamed toolUse input as json.null", "keeps null members of a toolUse input as json.null".google/client_test: "keeps null members of streamed functionCall args as json.null", "keeps null members of functionCall args as json.null".All tests ran with a
wippybinary built from the runtime PR branch:json.raw, and they pin that those drivers need no change.llmsuite passes (2930 tests, 9 skipped), andwippy lint --level errorreports no issues.Note
Callers get ordered schemas by passing
schema = json.raw(text). Tool schemas that the agent module reads from registryinput_schematext are still decoded into tables before they reachllm, so their order is still lost there. That is a separate change in the agent module.