Skip to content

fix(agent): reject malformed tool call arguments - #61784

Merged
teknium1 merged 0 commit into
mainfrom
fix/reject-malformed-tool-args
Jul 10, 2026
Merged

teknium1 merged 0 commit into
mainfrom
fix/reject-malformed-tool-args

Conversation

@teknium1

ghost commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Malformed, scalar, array, empty, and truncated tool arguments now produce one error result without executing, while valid siblings continue.

Changes

  • Implement the behavior at the existing subsystem chokepoint rather than adding a parallel runtime.
  • Preserve current prompt caching, message-role alternation, profile isolation, and provider wire compatibility.
  • Add focused regression coverage for the corrected success, failure, interruption, or restart paths.

Validation

10 targeted tests + 9 guardrail regressions passed.

agent/tool_executor.py                           | 70 +++++++++++++----
 tests/run_agent/test_malformed_tool_arguments.py | 98 ++++++++++++++++++++++++
 2 files changed, 153 insertions(+), 15 deletions(-)

Infographic

02-malformed-args

@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 P2 Medium — degraded but workaround exists labels Jul 10, 2026
@teknium1
teknium1 force-pushed the fix/reject-malformed-tool-args branch from 7f470f7 to 890bbf5 Compare July 10, 2026 03:31
@teknium1
teknium1 force-pushed the fix/reject-malformed-tool-args branch from 890bbf5 to 04e5766 Compare July 10, 2026 03:43
@teknium1
teknium1 merged commit 5e50f18 into main Jul 10, 2026
31 checks passed
@teknium1
teknium1 deleted the fix/reject-malformed-tool-args branch July 10, 2026 03:52
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
* fix(agent): reject malformed tool call arguments

* test(agent): expect malformed tool arguments to fail closed
justemu pushed a commit to justemu/hermes-agent that referenced this pull request Jul 18, 2026
* fix(agent): reject malformed tool call arguments

* test(agent): expect malformed tool arguments to fail closed
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
* fix(agent): reject malformed tool call arguments

* test(agent): expect malformed tool arguments to fail closed
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
* fix(agent): reject malformed tool call arguments

* test(agent): expect malformed tool arguments to fail closed
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
* fix(agent): reject malformed tool call arguments

* test(agent): expect malformed tool arguments to fail closed
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
* fix(agent): reject malformed tool call arguments

* test(agent): expect malformed tool arguments to fail closed
teknium1 added a commit that referenced this pull request Sep 19, 2026
Some OpenAI-compatible gateways emit `arguments: ""` (or whitespace) for a
tool whose schema has no required parameters. On the tool_search bridge path
(`normalize_tool_call_entries`) that string went straight into json.loads and
every attempt failed with "arguments is not valid JSON: Expecting value ...",
so the model retried the same call forever and the tool never ran (#83937).

Treat a blank string like the already-accepted `None`: it means {}. The
outer-loop already does this for the top-level tool_call arguments string
(turn_tool_validation), so the bridge was the only surface left rejecting the
shape; a tool with required params still gets the proper "missing required"
hint from validate_deferred_call_args, and malformed non-blank JSON keeps
failing closed (#61784 intent intact).

Co-authored-by: webtecnica <webtecnica@gmail.com>
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 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.

2 participants