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

Function TestRunawayNudgeFiresWhenCounterSkipsCap

internal/tui/tui_test.go:1992–2007  ·  view source on GitHub ↗

TestRunawayNudgeFiresWhenCounterSkipsCap: a multi-tool-call round increments toolRounds per call but the nudge is consulted only when the pending queue drains, so the counter can jump from below maxToolRounds to above it without ever landing on it. The latch (not a bare equality test) must still fir

(t *testing.T)

Source from the content-addressed store, hash-verified

1990
1991 m.llmRounds = maxLLMRounds
1992 m.maybeRunawayNudge()
1993 if n := countSystem(m.history); n != 1 {
1994 t.Fatalf("at the cap expected one system nudge, got %d:\n%+v", n, m.history)
1995 }
1996 last := m.history[len(m.history)-1]
1997 if !strings.Contains(last.Content, fmt.Sprintf("%d round-trips", maxLLMRounds)) {
1998 t.Fatalf("runaway nudge should name the count: %q", last.Content)
1999 }
2000
2001 // Immediately after, and anywhere inside the interval, it must stay quiet.
2002 m.llmRounds = maxLLMRounds + runawayNudgeInterval - 1
2003 m.maybeRunawayNudge()
2004 if n := countSystem(m.history); n != 1 {
2005 t.Fatalf("inside the interval must not re-fire, got %d system notes", n)
2006 }
2007}
2008
2009// TestRunawayNudgeRefiresPeriodically: past the cap the check must keep firing
2010// every runawayNudgeInterval rounds. Under the old once-per-turn latch a turn

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
countSystemFunction · 0.85
maybeRunawayNudgeMethod · 0.80

Tested by

no test coverage detected