claude-failover/internal
Ubuntu 7c5f8384fa fix(quota): add cooldown + 2-poll confirmation to prevent swap ping-pong
Anthropic HTTP 500 errors surface in the TUI with payloads containing
"rate limit" text, which the monitor was matching against quotaPatterns
and treating as a real 429 quota hit. With no cooldown and no
confirmation, a burst of 500s produced sub-minute ping-pong swaps that
tore down user sessions.

Two-layer fix:
- quota.reactivate_cooldown (already in config, 5m) now gates the
  monitor too — not just the dispatcher. A completed swap suppresses
  further detection for the cooldown window.
- A hit with no parseable reset time is treated as suspected only on
  the first poll; a second consecutive poll is required before
  emitting SwapRequested. Legitimate 429s with "resets in ..." still
  swap instantly on the first detection.

Adds state.RecordSwap / LastSwapInfo for the cooldown, and a
forensic log line on every detection: trigger_session, matched
pattern, 120-char pane snippet.

Tests cover: instant swap with reset, 2-poll confirmation without
reset, and suspected-state reset on recovery.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 19:18:27 +00:00
..
api feat: SessionLifecycleManager — auto-detect and repair dead tmux sessions 2026-04-14 18:02:25 +00:00
config feat(watcher): Phase 2.1 — SessionWatcher goroutine 2026-04-14 20:27:51 +00:00
dispatcher feat(dispatcher): Phase 2.2 — Task Dispatcher avec fsnotify 2026-04-14 20:30:08 +00:00
janitor feat: Phase 2.7+3 — full integration, config update, systemd unit 2026-04-15 00:15:06 +00:00
lifecycle feat: SessionLifecycleManager — auto-detect and repair dead tmux sessions 2026-04-14 18:02:25 +00:00
notify feat(notify): Phase 2.5 — Notifier Telegram + Resend email 2026-04-14 20:28:46 +00:00
quota fix(quota): add cooldown + 2-poll confirmation to prevent swap ping-pong 2026-04-15 19:18:27 +00:00
state fix(quota): add cooldown + 2-poll confirmation to prevent swap ping-pong 2026-04-15 19:18:27 +00:00
switcher fix(quota): add cooldown + 2-poll confirmation to prevent swap ping-pong 2026-04-15 19:18:27 +00:00
tmux feat: SessionLifecycleManager — auto-detect and repair dead tmux sessions 2026-04-14 18:02:25 +00:00
watcher feat(watcher): Phase 2.1 — SessionWatcher goroutine 2026-04-14 20:27:51 +00:00