feat(combo): add per-model timeout for faster combo fallback#2646
Open
berthojoris wants to merge 1 commit into
Open
feat(combo): add per-model timeout for faster combo fallback#2646berthojoris wants to merge 1 commit into
berthojoris wants to merge 1 commit into
Conversation
- Added COMBO_MODEL_TIMEOUT_MS configuration to set a timeout for each model in a combo. - Updated handleComboChat function to handle timeouts, allowing for graceful fallback to the next model if the timeout is exceeded. - Enhanced CombosPage to include a UI input for setting the timeout per model. - Updated handleChat to log the combo timeout settings for better visibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds configurable per-model timeout to combo fallback, so when a model is busy or timing out, the combo falls back to the next model faster instead of waiting the full 60s fetch connect timeout.
Changes
1. Per-combo timeout config (
timeoutMsincomboStrategies)src/sse/handlers/chat.js— ReadstimeoutMsfromcomboStrategies(per-combo), falls back to globalCOMBO_MODEL_TIMEOUT_MSenv var, then to 0 (disabled). Passes it tohandleComboChat().2. Promise.race timeout in
handleComboChat()open-sse/services/combo.js— AcceptscomboTimeoutMsparameter. When > 0, wraps each model call inPromise.racewith a timer. On timeout, the error carriesisComboTimeout: true— the catch block skips settinglastErrorso the final error message stays accurate. Fallback continues to the next model.3. UI input on combo dashboard
src/app/(dashboard)/dashboard/combos/page.js— Adds a small timeout input (in seconds) next to the strategy selector for fallback/round-robin combos. Fusion combos use their own panel timeout and are excluded. Updated pruning logic to preservetimeoutMsinhandleSetComboStrategy.4. Global env override
open-sse/config/runtimeConfig.js— AddsCOMBO_MODEL_TIMEOUT_MSenv-controlled default (0 = disabled, use existing 60s fetch connect timeout).How it works
Files changed
open-sse/services/combo.jssrc/sse/handlers/chat.jsopen-sse/config/runtimeConfig.jssrc/app/(dashboard)/dashboard/combos/page.jsMade with Cursor