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))
|
toolsRegistry.Register(tools.NewListDirTool(workspace, readRestrict, allowReadPaths))
|
||||||
}
|
}
|
||||||
if cfg.Tools.IsToolEnabled("exec") {
|
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 {
|
if err != nil {
|
||||||
logger.ErrorCF("agent", "Failed to initialize exec tool; continuing without exec",
|
logger.ErrorCF("agent", "Failed to initialize exec tool; continuing without exec",
|
||||||
map[string]any{"error": err.Error()})
|
map[string]any{"error": err.Error()})
|
||||||
execTool = nil
|
} else {
|
||||||
}
|
|
||||||
if execTool != nil {
|
|
||||||
toolsRegistry.Register(execTool)
|
toolsRegistry.Register(execTool)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3693,8 +3693,8 @@ func TestProcessMessage_MessageToolPublishesOutboundWithTurnMetadata(t *testing.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("processMessage() error = %v", err)
|
t.Fatalf("processMessage() error = %v", err)
|
||||||
}
|
}
|
||||||
if response == "" {
|
if response != "" {
|
||||||
t.Fatal("expected processMessage() to return a final loop response")
|
t.Fatalf("expected empty loop response when tool handles delivery, got %q", response)
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|
|
||||||
|
|
@ -139,5 +139,6 @@ func (t *MessageTool) Execute(ctx context.Context, args map[string]any) *ToolRes
|
||||||
return &ToolResult{
|
return &ToolResult{
|
||||||
ForLLM: fmt.Sprintf("Message sent to %s:%s", channel, chatID),
|
ForLLM: fmt.Sprintf("Message sent to %s:%s", channel, chatID),
|
||||||
Silent: true,
|
Silent: true,
|
||||||
|
ResponseHandled: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue