Repository navigation
Conversation
guglielmo-san
approved these changes
Oct 30, 2026
Contributor
|
@po-et Thanks for the fix! main requires branches to be up to date before merging, and maintainers can't push to this branch. Could you click "Update branch" (there are no conflicts), or enable "Allow edits by maintainers" so we can do it? |
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.
An empty tool output in a sampling conversation currently becomes
{"type":"text"}insideToolResultContent, losing the requiredtextfield. Empty image and audio fields are lost in the same way. Each child already marshals correctly, butToolResultContentdecodes that JSON intowireContentand marshals it again withomitempty. That intermediate decode can also round integers in child metadata before sending them.Keep the child marshaler's JSON as
json.RawMessageinstead. Nil and empty content still emit[], and child marshaling errors still propagate. This change concerns outgoing sampling tool results; it does not change incoming number decoding.The regression exercises
CreateMessageWithToolsover serialized in-memory transports using protocol 2025-11-25 and inspects the JSON received by the client. Five cases fail on the original source and pass with the fix, including empty text/image/audio, mixed content, and an exact metadata integer above 2^53. Empty arrays, embedded resources, annotations, and marshaling errors are controls. Sampling is deprecated in the newer protocol but remains supported by the SDK.Local validation on macOS arm64: Go 1.26.9 full race tests, build and vet; Go 1.25.6 full tests; formatting and diff checks. The final test update was rerun on both versions, with race detection on 1.26. Staticcheck 0.8.1 passed; this is the local Go 1.26-compatible version, rather than CI's pinned 0.6.1. External conformance suites were not run.
AI assistance: Codex was used for investigation, implementation, tests, independent review, and this description.