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

Function TestEmptyReplyNudgeFiresOnceThenSurfaces

internal/tui/tui_test.go:3288–3310  ·  view source on GitHub ↗

TestEmptyReplyNudgeFiresOnceThenSurfaces: if the model stays empty even after the re-prompt (e.g. a server that deterministically swallows the call), the latch must stop at one retry (no infinite loop) and the failure must be surfaced rather than dying silently as before.

(t *testing.T)

Source from the content-addressed store, hash-verified

3286 t.Fatalf("empty reply must trigger exactly one re-prompt (want 2 requests, got %d)", round)
3287 }
3288 var sawNudge bool
3289 for _, msg := range final.history {
3290 if msg.Role == chmctx.RoleSystem && strings.Contains(msg.Content, "no reply and no tool call") {
3291 sawNudge = true
3292 }
3293 }
3294 if !sawNudge {
3295 t.Fatalf("expected an empty-reply system nudge in history; got %+v", final.history)
3296 }
3297 scroll := stripANSI(final.scroll.String())
3298 if !strings.Contains(scroll, "fixed and verified") {
3299 t.Fatalf("recovered summary missing from scroll:\n%s", scroll)
3300 }
3301 if strings.Contains(scroll, "dropped the call") {
3302 t.Fatalf("a recovered turn must not surface the persistent-empty diagnostic:\n%s", scroll)
3303 }
3304 if final.phase != phaseIdle {
3305 t.Fatalf("turn must end idle after recovery, phase=%v", final.phase)
3306 }
3307}
3308
3309// TestEmptyReplyNudgeFiresOnceThenSurfaces: if the model stays empty even after
3310// the re-prompt (e.g. a server that deterministically swallows the call), the
3311// latch must stop at one retry (no infinite loop) and the failure must be
3312// surfaced rather than dying silently as before.
3313func TestEmptyReplyNudgeFiresOnceThenSurfaces(t *testing.T) {

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
drainFinalFunction · 0.85
stripANSIFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected