Skip to content

feat: recover to original model after cooldown expires#5

Merged
ShutovKS merged 1 commit into
devfrom
feat/recover-original-model
Jul 13, 2026
Merged

feat: recover to original model after cooldown expires#5
ShutovKS merged 1 commit into
devfrom
feat/recover-original-model

Conversation

@ShutovKS

Copy link
Copy Markdown
Owner

Проблема

Один короткий транзиентный сбой навсегда переключал сессию на fallback: chat.message форсил currentModel до конца сессии и никогда не возвращался к выбранной пользователем (обычно премиум) модели.

Решение

На chat.message, как только истёк cooldown исходной модели, плагин восстанавливает её (сбрасывает attempts, шлёт toast «Recovered to …») вместо того чтобы залипать на fallback.

  • Новая опция recover_original_model (по умолчанию true).
  • Рекавери пропускается, если исходная модель в unavailable_models.
  • Использует уже существующий pruneExpiredCooldowns (из PR fix: prune expired model cooldowns from session state #2).

Тесты

  • В пределах cooldown — остаётся на fallback.
  • После истечения cooldown — возвращается на original, attempts сброшен, status это подтверждает, показан recovery-toast.
  • При recover_original_model: false — остаётся на fallback.

Юнит-тесты 47/47, typecheck чист.

🤖 Generated with Claude Code

Previously a single transient error switched the session to a fallback
model permanently: chat.message forced currentModel for the rest of the
session and never returned to the user's chosen model.

Now, on chat.message, once the original model's cooldown has elapsed the
plugin restores it (resetting attempts and notifying via toast) instead of
staying on the fallback. Gated by the new `recover_original_model` option
(default true); skipped if the original is in unavailable_models.

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

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 5c51eba into dev Jul 13, 2026
1 check passed
@ShutovKS ShutovKS deleted the feat/recover-original-model branch July 13, 2026 23:42
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