Skip to content

feat: narrow try-again pattern, add configurable retry_on_patterns#4

Merged
ShutovKS merged 1 commit into
devfrom
feat/narrow-retry-patterns
Jul 13, 2026
Merged

feat: narrow try-again pattern, add configurable retry_on_patterns#4
ShutovKS merged 1 commit into
devfrom
feat/narrow-retry-patterns

Conversation

@ShutovKS

Copy link
Copy Markdown
Owner

Проблема

  • Паттерн /try.?again/ ложно срабатывал на нетранзиентных сообщениях («try again with a different prompt»).
  • Список паттернов был захардкожен — нельзя добавить провайдер-специфичную фразу.

Решение

  • try again сужен: требуется транзиентный квалификатор — later|soon|shortly|moment|in Ns.
  • Новая опция retry_on_patterns: string[] — пользовательские regex-источники (case-insensitive), добавляются к встроенным. Некорректные regex молча пропускаются (не роняют инициализацию плагина).
  • isRetryableError получил необязательный 3-й аргумент patterns (дефолт сохранён — существующие вызовы не ломаются).

Тесты

Bare «try again» → не ретраится; «try again later/in 20s» → ретраится; кастомный паттерн работает и в normalizeOptions, и в потоке session.error; невалидный regex пропущен. Юнит-тесты 44/44, typecheck чист.

🤖 Generated with Claude Code

The `/try.?again/` pattern matched non-transient messages (e.g. "try again
with a different prompt"). It now requires the transient qualifier
(later/soon/shortly/moment/in Ns).

Adds a `retry_on_patterns` option: user-supplied regex sources (case-
insensitive) appended to the built-in patterns. Invalid sources are skipped
rather than crashing plugin init. isRetryableError takes an optional
patterns argument (defaults preserved for existing callers).

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

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 464b90a into dev Jul 13, 2026
1 check passed
@ShutovKS ShutovKS deleted the feat/narrow-retry-patterns branch July 13, 2026 23:38
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