TestRunawayNudgeFiresOnceAtMaxToolRounds: the per-turn tool-call counter trips exactly one soft system note when it reaches maxToolRounds, and never before or after. A once-per-turn latch keeps a long turn from double-firing it.
(t *testing.T)
| 1959 | // the repeated-failure backstop's counters. |
| 1960 | func TestClearResetsFailureStreak(t *testing.T) { |
| 1961 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 1962 | m.failKey = tools.BashName + "|make build" |
| 1963 | m.failStreak = maxToolFailStreak - 1 |
| 1964 | out, _ := m.runSlash("/clear") |
| 1965 | final := out.(Model) |
| 1966 | if final.failStreak != 0 || final.failKey != "" { |
| 1967 | t.Fatalf("/clear must reset the failure streak, got key=%q streak=%d", |
| 1968 | final.failKey, final.failStreak) |
| 1969 | } |
| 1970 | } |
| 1971 | |
| 1972 | // countSystem counts RoleSystem messages, the shape every nudge appends. |
| 1973 | func countSystem(history []chmctx.Message) int { |
| 1974 | n := 0 |
| 1975 | for _, msg := range history { |
| 1976 | if msg.Role == chmctx.RoleSystem { |
| 1977 | n++ |
| 1978 | } |
| 1979 | } |
| 1980 | return n |
| 1981 | } |
| 1982 | |
| 1983 | // TestRunawayNudgeFiresOnceAtMaxToolRounds: the per-turn tool-call counter trips |
| 1984 | // exactly one soft system note when it reaches maxToolRounds, and never before |
| 1985 | // or after. A once-per-turn latch keeps a long turn from double-firing it. |
| 1986 | func TestRunawayNudgeFiresOnceAtMaxToolRounds(t *testing.T) { |
| 1987 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 1988 |
nothing calls this directly
no test coverage detected