chore: small fixes

kujtimiihoxha created

Change summary

internal/event/logger.go     | 9 +++++----
internal/llm/agent/agent.go  | 2 +-
internal/llm/agent/errors.go | 1 +
3 files changed, 7 insertions(+), 5 deletions(-)

Detailed changes

internal/event/logger.go 🔗

@@ -1,6 +1,7 @@
 package event
 
 import (
+	"fmt"
 	"log/slog"
 
 	"github.com/posthog/posthog-go"
@@ -11,17 +12,17 @@ var _ posthog.Logger = logger{}
 type logger struct{}
 
 func (logger) Debugf(format string, args ...any) {
-	slog.Debug(format, args...)
+	slog.Debug(fmt.Sprintf(format, args...))
 }
 
 func (logger) Logf(format string, args ...any) {
-	slog.Info(format, args...)
+	slog.Info(fmt.Sprintf(format, args...))
 }
 
 func (logger) Warnf(format string, args ...any) {
-	slog.Warn(format, args...)
+	slog.Warn(fmt.Sprintf(format, args...))
 }
 
 func (logger) Errorf(format string, args ...any) {
-	slog.Error(format, args...)
+	slog.Error(fmt.Sprintf(format, args...))
 }

internal/llm/agent/agent.go 🔗

@@ -578,7 +578,7 @@ loop:
 			}
 		case <-timer.C:
 			a.finishMessage(ctx, &assistantMsg, message.FinishReasonError, "Stream timeout", "No chunk received within timeout")
-			return assistantMsg, nil, fmt.Errorf("stream chunk timeout")
+			return assistantMsg, nil, ErrStreamTimeout
 		case <-ctx.Done():
 			a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled, "Request cancelled", "")
 			return assistantMsg, nil, ctx.Err()

internal/llm/agent/errors.go 🔗

@@ -7,6 +7,7 @@ import (
 
 var (
 	ErrRequestCancelled = errors.New("request canceled by user")
+	ErrStreamTimeout    = errors.New("stream chunk timeout")
 	ErrSessionBusy      = errors.New("session is currently processing another request")
 )