fix(tui): keep the alternation window across stuck-guard episode resets

reset_episode cleared step_history and alternation_repeats, so the A-B-A-B
alternation detector starved on every assistant/tool category switch —
the #5104 alternation test could never fire against its own
implementation (its 7-check CI never ran the full suite; merged red).
Episode resets now leave the alternation window intact.

Verified: cargo test -p codewhale-tui --bin codewhale-tui stuck — 11 passed, 0 failed (exit=0).
This commit is contained in:
Hmbown committed 2026-08-02 21:13:08 -07:00
1 parent bc51d56376
commit 25b62468e2
1 file changed
+3 -2
+3 -2
View File
@@ -259,8 +259,9 @@ impl StuckGuard {
self.repeated_actions = 0;
self.repeated_pairs = 0;
self.no_progress_messages = 0;
self.step_history.clear();
self.alternation_repeats = 0;
// step_history and alternation_repeats deliberately survive: the
// alternation detector's A-B-A-B window spans the category switches
// an episode reset represents, so clearing here would starve it.
self.warned = false;
self.repeats_after_warning = 0;
self.last_reason = None;