Download this file
| 1 | package codex |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "testing" |
| 6 | |
| 7 | "amadan.net/oficina/equipo/internal/runner/provider" |
| 8 | ) |
| 9 | |
| 10 | func TestCodexFirstTurnDoesNotResumeUnpersistedThread(t *testing.T) { |
| 11 | f := fixtureFor(t) |
| 12 | f.host.set("unpersisted") |
| 13 | s, events := openFixture(t, f) |
| 14 | for _, id := range []string{"first", "second"} { |
| 15 | if err := f.l.StartTurn(context.Background(), s, provider.Turn{ID: id, AdmissionID: id, Prompt: "ready"}); err != nil { |
| 16 | t.Fatal(err) |
| 17 | } |
| 18 | if ev := terminal(t, events); ev.Kind != "turn.completed" { |
| 19 | t.Fatal(ev) |
| 20 | } |
| 21 | } |
| 22 | if f.host.count("thread/start") != 1 || f.host.count("thread/resume") != 1 || f.host.count("turn/start") != 2 { |
| 23 | t.Fatal("thread lifecycle not preserved") |
| 24 | } |
| 25 | } |
| 26 | |