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

Function TestQueueWaitsForVerifyNudge

internal/tui/queue_test.go:214–239  ·  view source on GitHub ↗

TestQueueWaitsForVerifyNudge: a substantial clean finish triggers the verify re-grounding nudge, which continues the turn. The queued prompt must NOT fire then (the turn isn't ending); it stays queued until the turn truly ends.

(t *testing.T)

Source from the content-addressed store, hash-verified

212// re-grounding nudge, which continues the turn. The queued prompt must NOT fire
213// then (the turn isn't ending); it stays queued until the turn truly ends.
214func TestQueueWaitsForVerifyNudge(t *testing.T) {
215 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
216 m.installTurnContext()
217 m.phase = phaseStreaming
218 m.toolRounds = verifyNudgeMinRounds // substantial → verify nudge fires
219 m.llmRounds = verifyNudgeMinRounds
220 m.turnActed = true // the turn wrote something; a read-only turn is exempt
221 m.stream = make(chan llm.Event)
222 m.history = []chmctx.Message{
223 {Role: chmctx.RoleUser, Content: "build it"},
224 {Role: chmctx.RoleAssistant, Content: "Done, all features built."},
225 }
226 m.queued = &queuedPrompt{send: "now deploy", echo: "now deploy"}
227
228 out, cmd := m.handleStreamClosed()
229 om := out.(Model)
230
231 if cmd == nil || !om.verifyNudged {
232 t.Fatal("a substantial clean finish must re-prompt via the verify nudge")
233 }
234 if om.queued == nil || om.queued.send != "now deploy" {
235 t.Fatalf("the queued prompt must wait through the verify re-prompt, got %+v", om.queued)
236 }
237 last := om.history[len(om.history)-1]
238 if last.Role != chmctx.RoleSystem {
239 t.Fatalf("the re-prompt must append the verify note, not the queued user msg, got %+v", last)
240 }
241}
242

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
installTurnContextMethod · 0.80
handleStreamClosedMethod · 0.80

Tested by

no test coverage detected