From b8ddf2872ad0bfc1b30d891b7856bd5f58be6486 Mon Sep 17 00:00:00 2001 From: Haytham Amin Date: Sat, 21 Feb 2026 23:25:22 -0800 Subject: [PATCH] fix conflicts --- pkg/agent/loop.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 7a3a10089..358b23b57 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -711,13 +711,26 @@ func (al *AgentLoop) runLLMIteration( } toolResult := agent.Tools.ExecuteWithContext( - ctx, + toolCtx, tc.Name, tc.Arguments, opts.Channel, opts.ChatID, asyncCallback, ) + toolSpan.SetAttributes( + attribute.Int64("tool.duration_ms", time.Since(startedAt).Milliseconds()), + attribute.Bool("tool.silent", toolResult.Silent), + attribute.Int("tool.for_user_len", len(toolResult.ForUser)), + attribute.Int("tool.for_llm_len", len(toolResult.ForLLM)), + ) + if toolResult.Err != nil { + toolSpan.RecordError(toolResult.Err) + toolSpan.SetStatus(codes.Error, toolResult.Err.Error()) + } else if toolResult.IsError { + toolSpan.SetStatus(codes.Error, toolResult.ForLLM) + } + toolSpan.End() // Send ForUser content to user immediately if not Silent if !toolResult.Silent && toolResult.ForUser != "" && opts.SendResponse {