Skip to content

fix(tools): reject tool calls missing schema-required arguments before dispatch - #84798

Closed
JoaoMarcos44 wants to merge 1 commit into
NousResearch:mainfrom
JoaoMarcos44:fix/84689-required-arg-schema-validation
Closed

fix(tools): reject tool calls missing schema-required arguments before dispatch#84798
JoaoMarcos44 wants to merge 1 commit into
NousResearch:mainfrom
JoaoMarcos44:fix/84689-required-arg-schema-validation

Conversation

@JoaoMarcos44

Copy link
Copy Markdown
Contributor

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: checks parameters.required key absence (same contract as validate_deferred_call_args), returns tool_error(..., effect_disposition="not_started", retryable=True).
  • Wired into handle_function_call after the agent-loop check, before the pre_tool_call hook.
  • Updated 5 test_model_tools calls and 1 test_sanitize_tool_error call that used "q" as a placeholder for web_search's required query field.

Test Plan

  • New test_missing_required_arg_is_rejected_before_dispatch (reject {} with not_started, allow valid call).
  • scripts/run_tests.sh on model_tools + async bridge + tool_search + sanitize_tool_error + transform hook → 51/51.

Closes #84689

…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
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels Aug 12, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #61550 — both add required-key-only JSON-Schema validation to normal model-tool dispatch before side effects. #61550 is the earlier, broader implementation and also validates final execution boundaries.

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

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/tools Tool registry, model_tools, toolsets duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Tool dispatch does not validate args against JSON Schema (required/types/additionalProperties ignored)

2 participants