drainFinal submits a prompt and pumps the whole turn to completion, returning the settled model. Centralises the submit+drain dance the empty-reply tests share.
(t *testing.T, m Model, prompt string)
| 3335 | |
| 3336 | // TestEmptyReplyNudgeFiresOnceThenSurfaces: if the model stays empty even after |
| 3337 | // the re-prompt (e.g. a server that deterministically swallows the call), the |
| 3338 | // latch must stop at one retry (no infinite loop) and the failure must be |
| 3339 | // surfaced rather than dying silently as before. |
| 3340 | func TestEmptyReplyNudgeFiresOnceThenSurfaces(t *testing.T) { |
| 3341 | var round int |
| 3342 | handler := func(w http.ResponseWriter, _ *http.Request) { |
| 3343 | w.Header().Set("Content-Type", "text/event-stream") |
| 3344 | round++ |
| 3345 | fmt.Fprintf(w, "data: %s\n\n", `{"choices":[{"delta":{},"finish_reason":"stop"}],"usage":{"completion_tokens":1}}`) |
no test coverage detected