Fix infinite loop in message tool and fix compilation error on main branch.
This commit is contained in:
parent
b43b81162b
commit
02755f60d0
3 changed files with 7 additions and 8 deletions
|
|
@ -102,13 +102,11 @@ func NewAgentInstance(
|
|||
toolsRegistry.Register(tools.NewListDirTool(workspace, readRestrict, allowReadPaths))
|
||||
}
|
||||
if cfg.Tools.IsToolEnabled("exec") {
|
||||
execTool, err := tools.NewExecToolWithDenyPaths(workspace, restrict, [][]*regexp.Regexp{allowReadPaths}, denyWritePaths, cfg)
|
||||
execTool, err := tools.NewExecToolWithConfig(workspace, restrict, cfg, allowReadPaths)
|
||||
if err != nil {
|
||||
logger.ErrorCF("agent", "Failed to initialize exec tool; continuing without exec",
|
||||
map[string]any{"error": err.Error()})
|
||||
execTool = nil
|
||||
}
|
||||
if execTool != nil {
|
||||
} else {
|
||||
toolsRegistry.Register(execTool)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3693,8 +3693,8 @@ func TestProcessMessage_MessageToolPublishesOutboundWithTurnMetadata(t *testing.
|
|||
if err != nil {
|
||||
t.Fatalf("processMessage() error = %v", err)
|
||||
}
|
||||
if response == "" {
|
||||
t.Fatal("expected processMessage() to return a final loop response")
|
||||
if response != "" {
|
||||
t.Fatalf("expected empty loop response when tool handles delivery, got %q", response)
|
||||
}
|
||||
|
||||
select {
|
||||
|
|
|
|||
|
|
@ -137,7 +137,8 @@ func (t *MessageTool) Execute(ctx context.Context, args map[string]any) *ToolRes
|
|||
|
||||
// Silent: user already received the message directly
|
||||
return &ToolResult{
|
||||
ForLLM: fmt.Sprintf("Message sent to %s:%s", channel, chatID),
|
||||
Silent: true,
|
||||
ForLLM: fmt.Sprintf("Message sent to %s:%s", channel, chatID),
|
||||
Silent: true,
|
||||
ResponseHandled: true,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue