(t *testing.T)
| 187 | } |
| 188 | |
| 189 | func TestRunMainTask_TaskDoneFailed(t *testing.T) { |
| 190 | client := &fakeClient{responses: []*llm.ChatResponse{ |
| 191 | taskDoneResponseWithArguments(`{"state":"FAILED"}`), |
| 192 | }} |
| 193 | runner := NewRunner(newTestDeps(client)) |
| 194 | |
| 195 | completed, _, err := runner.RunMainTask( |
| 196 | context.Background(), |
| 197 | []llm.Message{llm.NewTextMessage("user", "review this file")}, |
| 198 | "main.go", |
| 199 | ) |
| 200 | if err == nil || !strings.Contains(err.Error(), "task_done reported FAILED") { |
| 201 | t.Fatalf("expected task_done FAILED error, got %v", err) |
| 202 | } |
| 203 | if completed { |
| 204 | t.Fatal("task_done FAILED must not complete RunMainTask") |
| 205 | } |
| 206 | if client.calls != 1 { |
| 207 | t.Fatalf("expected terminal failure after 1 LLM call, got %d", client.calls) |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | func TestRunMainTask_InvalidTaskDoneStateRetries(t *testing.T) { |
| 212 | tests := []struct { |
nothing calls this directly
no test coverage detected