fix(tools): reject tool calls missing schema-required arguments before dispatch - #84798
Closed
JoaoMarcos44 wants to merge 1 commit into
Closed
Conversation
…e dispatch
The normal dispatch path coerced args but never validated required fields, so a
tool with required:["x"] executed with {}. Add a fail-open required-key-absence
check after coercion/middleware and before authorization/side effect (same
contract as validate_deferred_call_args), returning effect_disposition=not_started.
Closes NousResearch#84689
Collaborator
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
The normal dispatch path coerced args but never validated required fields, so a tool with
required:["x"]executed with{}. Adds a fail-open required-key-absence check after coercion/middleware and before authorization/side effect.Changes
model_tools._validate_tool_args_against_schema: checksparameters.requiredkey absence (same contract asvalidate_deferred_call_args), returnstool_error(..., effect_disposition="not_started", retryable=True).handle_function_callafter the agent-loop check, before the pre_tool_call hook.test_model_toolscalls and 1test_sanitize_tool_errorcall that used"q"as a placeholder forweb_search's requiredqueryfield.Test Plan
test_missing_required_arg_is_rejected_before_dispatch(reject{}withnot_started, allow valid call).scripts/run_tests.shon model_tools + async bridge + tool_search + sanitize_tool_error + transform hook → 51/51.Closes #84689