fix: use %v to format script tool args, fixing number type interpolation#2172
Merged
dgageot merged 1 commit intodocker:mainfrom Mar 19, 2026
Conversation
When script tool arguments have type: number, the LLM sends JSON numbers which are unmarshaled as float64 in Go. Formatting float64 with %s produces '%!s(float64=42)' instead of '42'. Using %v correctly formats all types. Fixes docker#2169 Assisted-By: docker-agent
rumpl
approved these changes
Mar 19, 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.
Summary
Fix script tool arguments with
type: numberbeing interpolated as%!s(float64=42)instead of42.Problem
When a script tool argument has
type: number, the LLM sends a JSON number which Go unmarshals asfloat64. Theexecutemethod usedfmt.Sprintf("%s=%s", key, value)to build environment variables, but%son afloat64produces%!s(float64=42)instead of42.Fix
Changed
%sto%vin the format string so all JSON types are formatted correctly:string→ unchanged behaviorfloat64(JSON numbers) → proper numeric representation (e.g.42,3.14)bool→true/falseAdded a test that exercises a tool with a
number-typed argument end-to-end.Fixes #2169