You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Tool input schema is validated after permission confirmation — users are asked to confirm calls that will fail validation #3320
Describe the bug
For a registered tool that requires confirmation (ASK), the permission gate runs before the executor validates the tool input against the tool's schema. So when the model produces a call that violates the schema (missing required property, wrong type), the user is asked to confirm it first. The schema error only comes back after the user approves, and the tool never runs.
The user has to approve a call that can never execute. In an AG-UI app this shows up as a confirmation card for a malformed operation. The model also cannot fix its own malformed call without a round trip through the user.
To Reproduce
Register a @Tool with a required String parameter scope, and add an ask rule for it.
Have the model call it with {}, or with {"scope": {"x": 1}}.
A permission confirmation (RequireUserConfirmEvent, AG-UI interrupt) is emitted.
Approve it. The tool result is Error: Parameter validation failed for tool '...': : required property 'scope' not found (or /scope: object found, string expected), and the tool is not executed.
Verified on 2.0.3 and on main (857e3e6) with a scripted model. In ReActAgent, evaluatePermissions / evaluateOne run before execution, and the schema check happens in the executor. executeStructuredTool notes that it mirrors "the schema validation the executor performs for registered tools".
Expected behavior
Validate the input against the tool schema before the permission gate. A call that fails validation should return the validation error to the model directly, as it does for tools that need no confirmation, without asking the user. This matches common agent-harness practice of validating input before prompting for permission.
Environment
AgentScope-Java 2.0.3 and main (857e3e6), JDK 21.
I will take this. The fix validates the tool input against its schema before the permission gate, and returns the same validation error the executor already produces, without asking the user to confirm a call that cannot run. A regression test will cover a missing required property and a wrong type, and a valid call will still pause for confirmation.
Category: bug | Status: Confirmed — medium severity (verified against main @ 857e3e6c by read-only analysis of the call chain; no repository files were modified)
The reported ordering is real. On the ASK path the permission gate runs first and input/schema validation happens only inside the executor, so a call that can never validate still produces a confirmation prompt.
Resolves the tool, then permissionEngine.checkPermission(tb, input) or legacy tb.checkPermissions(...) — no ToolValidator call anywhere in ReActAgent except :3695
Confirmation emitted
ReActAgent.java:3131
new RequireUserConfirmEvent(replyId, pending) + RequestStopEvent(PERMISSION_ASKING); runToolBatch is only reached when pending.isEmpty() (:3100)
"Parameter validation failed for tool '%s': %s\nPlease correct the parameters and try again."
Notes on the reporter's specifics:
executeStructuredTool (ReActAgent.java:3694, Javadoc at :3690-3691) does mirror the executor validation as stated, but it is also reached only inside dispatchToolCalls — i.e. behind the gate — so it does not change the confirmation ordering.
The non-ASK path has the same ordering; validation is deferred, not skipped (ALLOW/PASSTHROUGH/DENY go straight to runToolBatch). The defect is user-visible precisely because ASK pauses for a human.
Impact: the user is asked to approve an operation that is guaranteed to fail, and the model needs an extra user round trip to learn its call was malformed. In an AG-UI app this renders as a confirmation card for a call that can never execute. The tool does not run and no data is corrupted.
Suggested minimal fix.ToolValidator.validateInput(String input, Map<String,Object> schema) is already public (tool/ToolValidator.java:77) and evaluateOne already resolves the tool via activeToolkit.getTool(...) — so the check can be added there before the engine/legacy permission call, letting schema-invalid calls fall through to the existing executor path that emits the identical validation error. A more complete variant validates earlier in actingStream, removes the invalid calls from the gated set, and synthesizes their ToolResultBlock errors directly, which avoids the double validation pass and preserves DENY semantics.
Behavior decisions worth making explicit: an invalid call that would have matched a DENY rule now returns a validation error instead of a permission denial; legacy tools whose checkPermissions asks on invalid input stop asking. Mixed batches must still pause for the genuinely valid ASK calls — that case needs its own test.
Test coverage today:ToolExecutorTest asserts the validation message inside the executor; ReActAgentHitlTest covers pause/resume with valid input only; PermissionEngineTest covers rule resolution in isolation. Nothing asserts that a schema-invalid call bypasses RequireUserConfirmEvent, so a fix should add: (1) required-param tool + ASK rule called with {} → no confirmation event, validation error returned; (2) the same through the legacy ToolBase#checkPermissions path; (3) a mixed batch (one valid ASK + one invalid) where only the valid call asks.
Duplication: PR #3321 (fix(agent): validate tool input before the permission gate, @kalayciburak) already claims this issue and moves validation ahead of evaluatePermissions in actingStream. Reviewing that PR is the right next step; no competing change will be opened here.
Automated evaluation by github-manager (oss-maintainer)
Activity
kalayciburak commentedon Sep 27, 2026
I will take this. The fix validates the tool input against its schema before the permission gate, and returns the same validation error the executor already produces, without asking the user to confirm a call that cannot run. A regression test will cover a missing required property and a wrong type, and a valid call will still pause for confirmation.
oss-maintainer commentedon Sep 27, 2026
Issue Evaluation
Category:
bug| Status: Confirmed — medium severity (verified againstmain@857e3e6cby read-only analysis of the call chain; no repository files were modified)The reported ordering is real. On the ASK path the permission gate runs first and input/schema validation happens only inside the executor, so a call that can never validate still produces a confirmation prompt.
Call chain
agentscope-core/src/main/java/io/agentscope/core/ReActAgent.java:3069actingStream→evaluatePermissions(toolCalls)before any executionReActAgent.java:3395(evaluatePermissions),:3420(evaluateOne)permissionEngine.checkPermission(tb, input)or legacytb.checkPermissions(...)— noToolValidatorcall anywhere inReActAgentexcept:3695ReActAgent.java:3131new RequireUserConfirmEvent(replyId, pending)+RequestStopEvent(PERMISSION_ASKING);runToolBatchis only reached whenpending.isEmpty()(:3100)ReActAgent.java:3164→:3573→:3625runToolBatch→executeToolCalls→dispatchToolCallsio/agentscope/core/tool/Toolkit.java:614→:628callTools(...)→executor.executeAll(...)(ToolExecutor.java:374)io/agentscope/core/tool/ToolExecutor.java:201(executeCore),:231-242ToolValidator.validateInput(toolCall.getContent(), tool.getParameters())(:233)ToolExecutor.java:236-239"Parameter validation failed for tool '%s': %s\nPlease correct the parameters and try again."Notes on the reporter's specifics:
executeStructuredTool(ReActAgent.java:3694, Javadoc at:3690-3691) does mirror the executor validation as stated, but it is also reached only insidedispatchToolCalls— i.e. behind the gate — so it does not change the confirmation ordering.ALLOW/PASSTHROUGH/DENYgo straight torunToolBatch). The defect is user-visible precisely because ASK pauses for a human.Impact: the user is asked to approve an operation that is guaranteed to fail, and the model needs an extra user round trip to learn its call was malformed. In an AG-UI app this renders as a confirmation card for a call that can never execute. The tool does not run and no data is corrupted.
Suggested minimal fix.
ToolValidator.validateInput(String input, Map<String,Object> schema)is already public (tool/ToolValidator.java:77) andevaluateOnealready resolves the tool viaactiveToolkit.getTool(...)— so the check can be added there before the engine/legacy permission call, letting schema-invalid calls fall through to the existing executor path that emits the identical validation error. A more complete variant validates earlier inactingStream, removes the invalid calls from the gated set, and synthesizes theirToolResultBlockerrors directly, which avoids the double validation pass and preserves DENY semantics.Behavior decisions worth making explicit: an invalid call that would have matched a DENY rule now returns a validation error instead of a permission denial; legacy tools whose
checkPermissionsasks on invalid input stop asking. Mixed batches must still pause for the genuinely valid ASK calls — that case needs its own test.Test coverage today:
ToolExecutorTestasserts the validation message inside the executor;ReActAgentHitlTestcovers pause/resume with valid input only;PermissionEngineTestcovers rule resolution in isolation. Nothing asserts that a schema-invalid call bypassesRequireUserConfirmEvent, so a fix should add: (1) required-param tool + ASK rule called with{}→ no confirmation event, validation error returned; (2) the same through the legacyToolBase#checkPermissionspath; (3) a mixed batch (one valid ASK + one invalid) where only the valid call asks.Duplication: PR #3321 (
fix(agent): validate tool input before the permission gate, @kalayciburak) already claims this issue and moves validation ahead ofevaluatePermissionsinactingStream. Reviewing that PR is the right next step; no competing change will be opened here.Automated evaluation by github-manager (oss-maintainer)
fix(agent): validate tool input before the permission gate
fix(agent): validate tool input before the permission gate
fix(agent): validate tool input before the permission gate
fix(agent): validate tool input before the permission gate
fix(agent): validate tool input before the permission gate