fix: normalize tool arguments using parameter schemas#7980
Closed
whatevertogo wants to merge 1 commit intoAstrBotDevs:masterfrom
Closed
fix: normalize tool arguments using parameter schemas#7980whatevertogo wants to merge 1 commit intoAstrBotDevs:masterfrom
whatevertogo wants to merge 1 commit intoAstrBotDevs:masterfrom
Conversation
Open a dedicated discussion branch for centralizing tool argument normalization before implementation, so follow-up work can stay separate from the AstrBotDevs#7961 local fix. Constraint: Keep this branch based on upstream/master and avoid mixing in PR AstrBotDevs#7978 changes. Rejected: Stacking this discussion PR on the AstrBotDevs#7978 branch because it would make review diffs noisy. Directive: Implement only schema-guided coercion, not blind recursive JSON parsing. Confidence: medium Scope-risk: medium Reversibility: Drop this empty anchor commit if the design direction changes. Tested: not run; discussion anchor only Not-tested: implementation behavior because no code changed yet Related: AstrBotDevs#7961 Co-authored-by: OmX <omx@users.noreply.github.com>
Contributor
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
Contributor
Author
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.
Draft discussion PR for implementing a second-stage fix after #7961.
The goal is to centralize tool argument normalization so provider/model outputs like JSON-stringified arrays or objects can be recovered before tool execution, without adding one-off parsing blocks inside individual tools.
Proposed direction
arrayorobject.properties,items,anyOf, andoneOfconservatively.string, even if the string looks like JSON.Related cleanup
After the global path exists, the local
send_message_to_user.messagesJSON-string parsing workaround from #7978 can be removed and covered by shared normalizer tests.Scope notes
This should address issues similar to #7961 where the expected structured argument is delivered as a JSON string. It is not intended to solve unrelated tool-call problems such as duplicated tool names from streamed chunks or cases where a model already emitted
{}and the original content is lost.Current status
This PR currently contains only an empty anchor commit so we can discuss the implementation shape before pushing code.
Validation plan
anyOfobject/array coercionsend_message_to_user.messagesgoing through the common normalization path.uv run pytest tests/unit/test_message_tools.pyuv run ruff check ...uv run ruff format --check ...