Fix Optional Timeout Parameter in ShellExecuteTool#2108
Closed
hanydd wants to merge 1 commit into
Closed
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
hanydd
force-pushed
the
codex/fix-shell-execute-optional-params
branch
from
July 11, 2026 01:03
fc730a0 to
95a05a8
Compare
hanydd
marked this pull request as ready for review
July 11, 2026 01:16
hanydd
force-pushed
the
codex/fix-shell-execute-optional-params
branch
from
July 11, 2026 01:41
95a05a8 to
f75cecf
Compare
oss-maintainer
left a comment
Collaborator
There was a problem hiding this comment.
Summary
This PR modifies 2 file(s) (+111 -4).
Reviewed the changes and they look reasonable overall. No critical issues found.
Automated review by github-manager-bot
AgentScopeJavaBot
approved these changes
Jul 12, 2026
AgentScopeJavaBot
left a comment
Collaborator
There was a problem hiding this comment.
🤖 AI Review
Fixes ShellExecuteTool schema: marks working_directory and timeout as optional, changes timeout to Integer for null safety. 4 tests. Clean fix.
hanydd
force-pushed
the
codex/fix-shell-execute-optional-params
branch
from
July 18, 2026 05:27
f75cecf to
d4e5466
Compare
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.
问题
working_directory和timeout这两个参数在描述和实际代码中,都是有默认值的,但是实际注册schema的时候没有传入 @ToolParam(required=false)`,导致实际上这两个参数会被当成必填项进行校验,造成Agent调用频繁出错,造成效率损失。timeout参数是int类型,如果大模型没有返回这个值,那么反射处理参数的地方会传入null,传给primitiveint会直接报错。Summary
working_directoryandtimeoutas optional in the generated schematimeoutand default it to 30 seconds when omitted or non-positiveRoot cause
@ToolParam.required()defaults totrue, butShellExecuteTooldid not override it for its optional parameters. In addition, the primitiveinttimeout could not receive thenullproduced for an omitted argument.Testing
Result: 3 tests passed, 0 failures.
更新(2026-07-18)
更新原因
本 PR rebase 到最新
main后,提交0e67ac1be已将working_directory标记为可选,并优化了 shell 工具的使用提示。为避免重复修改,本 PR 保留该提交的语义,调整为只补充timeout的可选参数支持。当前调整
timeout仍可由调用方显式修改,正数值会原样传递给 sandbox。timeout时允许反射调用器传入null,并默认使用 30 秒。timeout为非正数时同样回退到 30 秒。command。最新验证
ShellExecuteToolTest共 4 个测试全部通过,覆盖 Schema、仅传command、显式 timeout 和非正数 timeout 的行为;timeout 新增判断的分支覆盖为 4/4。