TestSubmitResetsFailureStreak: a fresh user submission is a new goal, so a stale streak from the previous goal must not carry over and trip the nudge early. submit's non-slash path zeroes failKey/failStreak.
(t *testing.T)
| 1916 | func TestRepeatedFailureNudgeDifferentTargetResetsStreak(t *testing.T) { |
| 1917 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 1918 | fail := chmctx.Message{Role: chmctx.RoleTool, ToolName: tools.BashName, Content: "x\n(exit: exit status 1)"} |
| 1919 | |
| 1920 | var mm tea.Model = m |
| 1921 | // Each iteration fails, but against a different bash target, so the streak |
| 1922 | // keeps resetting to 1 and never reaches maxToolFailStreak. |
| 1923 | for i := 0; i < maxToolFailStreak+2; i++ { |
| 1924 | cur := mm.(Model) |
| 1925 | cur.lastToolKey = fmt.Sprintf("%s|echo %d", tools.BashName, i) |
| 1926 | out, _ := cur.recordAndNudge(fail) |
| 1927 | mm = out |
| 1928 | } |
| 1929 | final := mm.(Model) |
| 1930 | for _, msg := range final.history { |
| 1931 | if msg.Role == chmctx.RoleSystem { |
| 1932 | t.Fatalf("distinct targets must not trip the nudge, but one fired:\n%+v", final.history) |
| 1933 | } |
| 1934 | } |
nothing calls this directly
no test coverage detected