Skip to content

Commit 94dc3f1

Browse files
committed
tools/script_shell: Fix implicit all required parameters
When no required array was explicitly set in the shell tool configuration, the system was intended to default all arguments as required. However, the implementation was incorrectly creating a slice with length equal to the number of arguments but zero capacity, resulting in an empty required list. Signed-off-by: Paweł Gronowski <me@woland.xyz>
1 parent 22f8914 commit 94dc3f1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pkg/tools/builtin/script_shell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func NewScriptShellTool(shellTools map[string]latest.ScriptShellToolConfig, env
3737
func validateConfig(toolName string, tool latest.ScriptShellToolConfig) error {
3838
// If no required array was set, all arguments are required
3939
if tool.Required == nil {
40-
tool.Required = make([]string, len(tool.Args))
40+
tool.Required = make([]string, 0, len(tool.Args))
4141
for argName := range tool.Args {
4242
tool.Required = append(tool.Required, argName)
4343
}

0 commit comments

Comments
 (0)