Skip to content

feat: per-model failure counts and switch history in status#9

Merged
ShutovKS merged 1 commit into
devfrom
feat/metrics-history
Jul 14, 2026
Merged

feat: per-model failure counts and switch history in status#9
ShutovKS merged 1 commit into
devfrom
feat/metrics-history

Conversation

@ShutovKS

Copy link
Copy Markdown
Owner

Проблема

Не видно, какие модели флакают в долгой сессии и как именно происходили переключения — поддержка не может диагностировать поведение.

Решение

model_fallback_control status теперь дополнительно отдаёт:

  • failureCounts — сколько ретраимых ошибок пришлось на каждую модель.
  • switches — последние 20 переходов между моделями: from, to, reason (fallback | unavailable | recovery), at (timestamp).

Заполняется в точках switch (event), unavailable-redirect (chat.message) и recovery (chat.message). Сбрасывается вместе с остальным состоянием в reset.

Тесты

  • После двух каскадных fallback'ов status содержит оба failureCounts и две записи switches (reason=fallback).
  • Recovery записывает transition reason=recovery.
  • reset очищает метрики и историю.

Юнит-тесты 58/58, typecheck чист (попутно наведён type-narrowing в unavailable-ветке).

🤖 Generated with Claude Code

The model_fallback_control status now reports `failureCounts` (how many
retryable errors each model hit) and `switches` (last 20 model transitions
with from/to/reason/timestamp; reasons: fallback, unavailable, recovery).

Useful for diagnosing which models are flaky in a long session. Cleared on
reset alongside the rest of the session state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 14, 2026 08:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ShutovKS ShutovKS merged commit 5b336f3 into dev Jul 14, 2026
1 check passed
@ShutovKS ShutovKS deleted the feat/metrics-history branch July 14, 2026 08:02
@ShutovKS ShutovKS mentioned this pull request Jul 14, 2026
ShutovKS added a commit that referenced this pull request Jul 14, 2026
Documents all unreleased changes from #2-#9 and the 1.0.8 initial release.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants