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 | m.maybeRunawayNudge() |
| 1991 | if n := countSystem(m.history); n != 0 { |
| 1992 | t.Fatalf("below the cap must not nudge, got %d system notes", n) |
| 1993 | } |
| 1994 | |
| 1995 | m.toolRounds = maxToolRounds |
| 1996 | m.maybeRunawayNudge() |
| 1997 | if n := countSystem(m.history); n != 1 { |
| 1998 | t.Fatalf("at the cap expected one system nudge, got %d:\n%+v", n, m.history) |
| 1999 | } |
| 2000 | last := m.history[len(m.history)-1] |
| 2001 | if !strings.Contains(last.Content, fmt.Sprintf("%d tool calls", maxToolRounds)) { |
| 2002 | t.Fatalf("runaway nudge should name the count: %q", last.Content) |
| 2003 | } |
| 2004 | |
| 2005 | m.toolRounds = maxToolRounds + 1 |
| 2006 | m.maybeRunawayNudge() |
| 2007 | if n := countSystem(m.history); n != 1 { |
| 2008 | t.Fatalf("past the cap must not re-fire, got %d system notes", n) |
| 2009 | } |
| 2010 | } |
nothing calls this directly
no test coverage detected