Skip to content

Add configurable runtime fallback message patterns#2433

Open
zengxiaolou wants to merge 2 commits intocode-yeongyu:devfrom
zengxiaolou:feat/runtime-fallback-message-patterns
Open

Add configurable runtime fallback message patterns#2433
zengxiaolou wants to merge 2 commits intocode-yeongyu:devfrom
zengxiaolou:feat/runtime-fallback-message-patterns

Conversation

@zengxiaolou
Copy link

@zengxiaolou zengxiaolou commented Mar 10, 2026

Summary

  • add runtime_fallback.retry_on_message_patterns schema/config support so teams can define provider-specific retry text triggers without patching source
  • wire configured patterns into runtime fallback classification for session.error, message.updated, and session.status flows while keeping default behavior unchanged
  • add tests for configured no-available-accounts matching and document the new option in configuration reference

Validation

  • bun test src/hooks/runtime-fallback/error-classifier.test.ts src/hooks/runtime-fallback/index.test.ts

Summary by cubic

Adds support for runtime_fallback.retry_on_message_patterns so teams can trigger fallback on provider-specific messages (via regex), not just status codes. Patterns are applied across session.error, message.updated, and session.status flows; defaults stay the same.

  • New Features
    • New config option runtime_fallback.retry_on_message_patterns: string[] (regex strings), default [].
    • Message-based retry detection now merges built-in keywords with configured patterns.
    • Wired into isRetryableError and extractAutoRetrySignal and used by event and message update handlers.
    • Added tests for custom pattern matching (e.g., "no available accounts") and updated configuration docs with examples.

Written for commit b8c16ac. Summary will update on new commits.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: The PR safely introduces a new optional configuration for custom retry message patterns with appropriate regex handling, comprehensive tests, and no breaking changes to existing logic.


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

@zengxiaolou
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Mar 10, 2026
@acamq
Copy link
Collaborator

acamq commented Mar 10, 2026

@sisyphus-dev-ai

@sisyphus-dev-ai sisyphus-dev-ai added the sisyphus: working Sisyphus is currently working on this label Mar 10, 2026
@sisyphus-dev-ai
Copy link
Collaborator

Review Summary

I've reviewed PR #2433 and verified the implementation.

Verification Results

Check Status
Tests pass 63/63
TypeScript compiles Clean
Code quality Good
Follows existing patterns Yes

Implementation Analysis

What this PR adds:

  • New optional config retry_on_message_patterns: string[] for triggering runtime fallback on provider-specific error messages (via regex), not just HTTP status codes
  • Properly wired into all three fallback flows: session.error, message.updated, and session.status
  • Default value is [] (empty array), so existing behavior is unchanged

Code quality observations:

  1. Proper regex compilation with error handling - compilePatterns() gracefully skips invalid regex patterns
  2. Consistent pattern merging - Built-in patterns (AUTO_RETRY_SIGNAL_KEYWORD_PATTERNS) are merged with user-configured patterns
  3. Backward compatible - All functions accepting the new parameter have = [] defaults
  4. Good test coverage - 3 new test cases covering the feature:
    • Does NOT trigger without configured patterns (false positive protection)
    • DOES trigger when configured patterns match
    • Treats configured pattern matches as retryable errors

Documentation:

  • Config reference updated with example and description

Recommendation

LGTM - This is a clean, well-structured addition that enables teams to handle provider-specific retry scenarios (like "no available accounts" messages) without code changes. The implementation follows existing patterns and maintains backward compatibility.

Ready to merge.

@sisyphus-dev-ai sisyphus-dev-ai removed the sisyphus: working Sisyphus is currently working on this label Mar 10, 2026
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.

3 participants