X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/522d7fd117285e4e4ce3ea5ec9b5a1722521b681..f5c601f1801aaa276f8c335fcb51c373edc0b50c:/turn_test.go diff --git a/turn_test.go b/turn_test.go index 8173906..811487e 100644 --- a/turn_test.go +++ b/turn_test.go @@ -3,7 +3,6 @@ package main import ( "context" "encoding/json" - "log" "net/http" "path/filepath" "strings" @@ -225,7 +224,7 @@ func TestFailedCallEndsTheTurnWithoutARetry(t *testing.T) { require.Equal(t, 1, server.Calls()) require.Contains(t, test.events.Last("error"), "HTTP 503") require.Equal(t, 1, strings.Count(test.logs.String(), "\n")) - require.Contains(t, test.logs.String(), "turn failed: ") + require.Contains(t, test.logs.String(), "<3>turn failed: ") require.Contains(t, test.logs.String(), "HTTP 503") require.NotContains(t, test.logs.String(), "hello") } @@ -389,7 +388,7 @@ func turnInputTexts(t *testing.T, call ModelFakeCall) []string { func newTestTurnLoopWith(t *testing.T, server *ModelFake, summarizer Summarizer) *TurnTestLoop { t.Helper() - agent, err := openAgent(t.TempDir()) + agent, err := openAgent(filepath.Join(t.TempDir(), "agent")) require.NoError(t, err) agent.config.Workdir = t.TempDir() @@ -407,7 +406,7 @@ func newTestTurnLoopWith(t *testing.T, server *ModelFake, summarizer Summarizer) client := newModelClient(server.URL, ModelAPIKey(modelTestKey), agent.CacheKey(), test.usagePath) whatsapp, _, _ := whatsappStartTest(t, t.TempDir(), clock) - test.loop, err = newTurnLoop(agent, memory, newTestSubagents(t), whatsapp, newTestSchedules(t, clock.Now), client, clock.Now, log.New(test.logs, "", 0), test.events.Add) + test.loop, err = newTurnLoop(agent, memory, newTestSubagents(t), whatsapp, newTestSchedules(t, clock.Now), client, clock.Now, daemonTestLogger(test.logs), test.events.Add) require.NoError(t, err) ctx, cancel := context.WithCancel(t.Context()) @@ -424,3 +423,12 @@ func newTestTurnLoopWith(t *testing.T, server *ModelFake, summarizer Summarizer) return test } + +func modelReasoningItem(id, encrypted string) map[string]any { + return map[string]any{ + "type": "reasoning", + "id": id, + "encrypted_content": encrypted, + "summary": []any{}, + } +}