(t *testing.T)
| 121 | } |
| 122 | |
| 123 | func TestController_Exec_LastSeq_Empty(t *testing.T) { |
| 124 | ctx := context.Background() |
| 125 | cid := "test-conv-seq" |
| 126 | |
| 127 | log := &executortest.MemoryEventLog{} |
| 128 | // Pre-populate history |
| 129 | log.AllEvents = []*proto.ConversationEvent{ |
| 130 | { |
| 131 | ConversationId: cid, |
| 132 | Seq: 1, |
| 133 | Messages: []*proto.Message{ |
| 134 | {Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "msg 1"}}}}, |
| 135 | }, |
| 136 | State: proto.State_STATE_COMPLETED, |
| 137 | }, |
| 138 | { |
| 139 | ConversationId: cid, |
| 140 | Seq: 2, |
| 141 | Messages: []*proto.Message{ |
| 142 | {Role: "assistant", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "msg 2"}}}}, |
| 143 | }, |
| 144 | State: proto.State_STATE_COMPLETED, |
| 145 | }, |
| 146 | } |
| 147 | |
| 148 | c, err := New(ctx, Config{ |
| 149 | EventLogBuilder: func() (executor.EventLog, error) { |
| 150 | return log, nil |
| 151 | }, |
| 152 | PlannerBuilder: func(ctx context.Context, r *Registry) (agent.Agent, error) { |
| 153 | return &dummyAgent{}, nil |
| 154 | }, |
| 155 | }) |
| 156 | if err != nil { |
| 157 | t.Fatal(err) |
| 158 | } |
| 159 | defer c.Close() |
| 160 | |
| 161 | var msgs []*proto.Message |
| 162 | handler := ExecHandler(func(resp *proto.ExecResponse) error { |
| 163 | msgs = append(msgs, resp.Outputs...) |
| 164 | return nil |
| 165 | }) |
| 166 | |
| 167 | err = c.Exec(ctx, &proto.ExecRequest{ |
| 168 | ConversationId: cid, |
| 169 | }, handler) |
| 170 | if err != nil { |
| 171 | t.Fatal(err) |
| 172 | } |
| 173 | if len(msgs) != 0 { |
| 174 | t.Fatalf("expected 0 messages, got %d", len(msgs)) |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | func TestController_Exec_LastSeq(t *testing.T) { |
| 179 | ctx := context.Background() |
nothing calls this directly
no test coverage detected