Skip to content

feat(combo): add per-model timeout for faster combo fallback#2646

Open
berthojoris wants to merge 1 commit into
decolua:masterfrom
berthojoris:feature/combo-timeout-handling
Open

feat(combo): add per-model timeout for faster combo fallback#2646
berthojoris wants to merge 1 commit into
decolua:masterfrom
berthojoris:feature/combo-timeout-handling

Conversation

@berthojoris

Copy link
Copy Markdown

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 (timeoutMs in comboStrategies)

  • src/sse/handlers/chat.js — Reads timeoutMs from comboStrategies (per-combo), falls back to global COMBO_MODEL_TIMEOUT_MS env var, then to 0 (disabled). Passes it to handleComboChat().

2. Promise.race timeout in handleComboChat()

  • open-sse/services/combo.js — Accepts comboTimeoutMs parameter. When > 0, wraps each model call in Promise.race with a timer. On timeout, the error carries isComboTimeout: true — the catch block skips setting lastError so 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 preserve timeoutMs in handleSetComboStrategy.

4. Global env override

  • open-sse/config/runtimeConfig.js — Adds COMBO_MODEL_TIMEOUT_MS env-controlled default (0 = disabled, use existing 60s fetch connect timeout).

How it works

User sets 15s timeout in dashboard
  -> comboStrategies["my-combo"].timeoutMs = 15000
    -> combo.js wraps each model with Promise.race(handleSingleModel, timer 15s)
      -> 15s without response -> error.isComboTimeout = true
        -> logs warning, falls to next model

Files changed

  • open-sse/services/combo.js
  • src/sse/handlers/chat.js
  • open-sse/config/runtimeConfig.js
  • src/app/(dashboard)/dashboard/combos/page.js

Made with Cursor

- 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.
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.

1 participant