X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/38a9b0502a1ccefc6ccb3472c4a21805b222caa6..5b778ad04422dd456b7d673fb653f0353c47b0fe:/subagent_run_test.go diff --git a/subagent_run_test.go b/subagent_run_test.go index 9b8b8c5..a59b499 100644 --- a/subagent_run_test.go +++ b/subagent_run_test.go @@ -3,6 +3,7 @@ package main import ( "context" "io" + "log" "net/http" "os" "path/filepath" @@ -66,6 +67,7 @@ func TestSpawnRunsASubagentInTheBackground(t *testing.T) { Source: name, Status: subagentFinished, }, test.events.LastEvent("work")) + require.Equal(t, "subagent "+name+" is done, and its report goes to the agent\n", test.logs.String()) var first, second *ModelFakeCall for n := range server.Calls() { @@ -188,6 +190,7 @@ func TestFullContextGivesAFailedReport(t *testing.T) { "reply: It failed.", }, test.Log(t)) require.Equal(t, subagentFailed, test.events.LastEvent("work").Status) + require.Equal(t, "subagent "+name+" failed, and its report tells the agent: model call: HTTP 400: "+subagentTestFullContext+"\n", test.logs.String()) } func TestSubagentHasItsOwnEffortAndNoSpawn(t *testing.T) { @@ -372,6 +375,7 @@ func TestStopEndsASubagentAndItsCommand(t *testing.T) { "work: " + subagentReport(name, []string{"stopped"}), }, test.Log(t)) require.Equal(t, subagentStopped, test.events.LastEvent("work").Status) + require.Equal(t, "subagent "+name+" is stopped by the user\n", test.logs.String()) log, err := subagent.Show() require.NoError(t, err) @@ -517,7 +521,7 @@ func subagentTestStart(t *testing.T, agent *Agent, server *ModelFake, events *Tu subagents := newSubagents(filepath.Join(agent.dir, subagentDirName), clock.Now, subagentNameRandom) client := newModelClient(server.URL, ModelAPIKey(modelTestKey), agent.CacheKey(), filepath.Join(agent.dir, "usage.jsonl")) whatsapp, _, _ := whatsappStartTest(t, t.TempDir(), clock) - loop, err := newTurnLoop(agent, memory, subagents, whatsapp, client, clock.Now, events.Add) + loop, err := newTurnLoop(agent, memory, subagents, whatsapp, newTestSchedules(t, clock.Now), client, clock.Now, log.New(io.Discard, "", 0), events.Add) require.NoError(t, err) ctx, cancel := context.WithCancel(t.Context())