Repository navigation
fix(core): reject incomplete and malformed tool-call arguments - #3739
Merged
Merged
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
This was referenced Oct 23, 2026
jujn
approved these changes
Oct 25, 2026
chickenlj
added a commit
that referenced
this pull request
Nov 13, 2026
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.
AgentScope-Java Version
2.1.0-SNAPSHOT
Description
Summary
Incomplete tool arguments can be normalized to
{}and executed. Retain the response finish reason, mark malformed arguments during accumulation, and return a paired error before the permission gate or handler. Complete sibling calls remain executable.Validate the entire argument string as one JSON object, including its suffix. Preserve the existing builders, no-argument accumulator method, and metadata storage shape. EN/ZH context documentation describes execution behavior.
Parent issue: #3737. This PR can target main independently; the Anthropic replay PR builds on it. Related: #2648 and #2841; this PR does not claim raw-argument retention or the complete large-output recovery policy.
Evidence
The baseline invokes a local counter tool for truncated JSON. Regression tests assert zero handler invocations, original-ID error pairing and events, and execution of two complete siblings in a mixed batch. A valid root followed by a second root or malformed suffix is rejected; complete
{}and trailing whitespace remain accepted.Isolated verification on upstream
07c5f3078d682da30f29e96b6d76f68242cbc2e1: 60 tests, 0 failures/errors/skips; Spotless passed.DeepSeek Harness
agent.ts:547stops before tool execution at max-tokens. ZCodetool-input-normalization.ts:32validates the whole string withJSON.parse, but its{}error fallback loses the failure. Keeping complete siblings and returning ASJ's normal error results is an ASJ-specific choice verified through handler counts.Merge Danger
Door: reversible code change. Blast radius: accumulated client tool calls across providers. Malformed raw JSON is rejected even if an application's custom codec can repair it; ordinary codec serialization/deserialization remains configurable. The strict validator does not change the global Jackson configuration. Existing ambiguous empty starts are rejected only when the output-limit condition is present.
Checklist