Skip to content

fix: preserve whitespace in string tool arguments - #206

Draft
hallerite wants to merge 1 commit into
mainfrom
codex/preserve-tool-string-whitespace
Draft

hallerite wants to merge 1 commit into
mainfrom
codex/preserve-tool-string-whitespace

Conversation

@hallerite

@hallerite hallerite commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

String tool arguments lose leading and trailing whitespace because five shared parsers trim the payload before schema-aware coercion. Preserve the raw payload so an argument such as " Paris\nMünchen ☁ " reaches the tool unchanged.

Remove payload trimming in the XML, GLM, Hy3, Laguna, and MiniMax parsers. Extend the existing real-tokenizer regression matrix with whitespace, newline, and empty-string cases, retaining Muse Glimmer's JSON-decoding contract.

Validation: the whitespace regression failed before the fix; 1,966 tool-argument, parser, parse-response, robustness, and roundtrip cases pass afterward with pinned assets and model downloads disabled. Ruff, formatting, and pre-commit passed.

This is an independently reviewable prerequisite for the portable conformance suite in #188.

Note

Fix whitespace trimming in string tool arguments across parsers

Stops trimming leading and trailing whitespace before string coercion in five tool-call parsers: XML, GLM, Hy3, Laguna-XS.2, and MiniMax (see renderers/parsing.py). Adds test cases for values with spaces, newlines, non-ASCII text, and empty strings, and compares MuseGlimmerRenderer output directly without JSON-decoding inputs.

  • Risk: string tool arguments now keep their surrounding whitespace — any consumer expecting trimmed values from these parsers will see the raw text.

Macroscope summarized 97defa9.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant