feat: Add model auto-switch functionality for improved error handling#18383
feat: Add model auto-switch functionality for improved error handling#18383freezed-corpse-143 wants to merge 1 commit intoanomalyco:devfrom
Conversation
- Add getFallbackModel function to provider module for automatic model switching - Add shouldFallbackToAlternativeModel function to determine when to switch models - Integrate model fallback logic in session processor error handling - Add ModelFallback event definition for TUI notifications - Add comprehensive tests for both new functions - Models switch on AuthError and non-retryable APIError, fallback to opencode/zen when no alternatives
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: PR #13189: feat: add model fallback support with TTFT-based timeout This PR appears related because it also implements model fallback functionality, though it uses a different approach (TTFT-based timeout vs. error-triggered auto-switching). You may want to review it to ensure there's no overlap or conflict between the two implementations, and to understand if the existing fallback mechanism should be enhanced or replaced by the auto-switch feature in PR #18383. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
PR introduces automatic model switching capability to enhance the reliability and user experience of the opencode system. When a model encounters specific types of errors, the system will automatically switch to an alternative model, with opencode/zen as the final fallback.
Key Features
Implementation Details
Usage
The feature is enabled by default and requires no configuration changes. Users will see TUI notifications when model switching occurs, providing transparency about the automatic recovery process.
Backward Compatibility
Performance Impact
Fixes #model-auto-switch-feature