MCPcopy Create free account
hub / github.com/codehamr/codehamr / drainFinal

Function drainFinal

internal/tui/tui_test.go:3337–3342  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
3340func 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}}`)

Calls 2

drainFunction · 0.85
submitMethod · 0.80

Tested by

no test coverage detected