Skip to content

Fix Parameter Schema in ShellExecuteTool#2108

Open
hanydd wants to merge 1 commit into
agentscope-ai:mainfrom
hanydd:codex/fix-shell-execute-optional-params
Open

Fix Parameter Schema in ShellExecuteTool#2108
hanydd wants to merge 1 commit into
agentscope-ai:mainfrom
hanydd:codex/fix-shell-execute-optional-params

Conversation

@hanydd

@hanydd hanydd commented Jul 10, 2026

Copy link
Copy Markdown

问题

  • working_directorytimeout 这两个参数在描述和实际代码中,都是有默认值的,但是实际注册schema的时候没有传入 @ToolParam(required=false)`,导致实际上这两个参数会被当成必填项进行校验,造成Agent调用频繁出错,造成效率损失。
  • timeout 参数是int类型,如果大模型没有返回这个值,那么反射处理参数的地方会传入null,传给primitive int会直接报错。

Summary

  • mark working_directory and timeout as optional in the generated schema
  • accept a nullable timeout and default it to 30 seconds when omitted or non-positive
  • add regression coverage for the schema, command-only reflective invocation, and explicit timeouts

Root cause

@ToolParam.required() defaults to true, but ShellExecuteTool did not override it for its optional parameters. In addition, the primitive int timeout could not receive the null produced for an omitted argument.

Testing

mvn -pl agentscope-harness -am "-Dtest=ShellExecuteToolTest" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dspotless.check.skip=true" test

Result: 3 tests passed, 0 failures.

@hanydd hanydd changed the title Fix optional parameters in ShellExecuteTool Fix Parameter Schema in ShellExecuteTool Jul 10, 2026
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@CLAassistant

CLAassistant commented Jul 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@hanydd hanydd force-pushed the codex/fix-shell-execute-optional-params branch from fc730a0 to 95a05a8 Compare July 11, 2026 01:03
@hanydd hanydd marked this pull request as ready for review July 11, 2026 01:16
@hanydd hanydd requested a review from a team July 11, 2026 01:16
@hanydd hanydd force-pushed the codex/fix-shell-execute-optional-params branch from 95a05a8 to f75cecf Compare July 11, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants