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)
| 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 |
nothing calls this directly
no test coverage detected