Skip to content

fix(opencode-plugin): increase fetch timeouts and remove combo/ prefix to fix provider errors - #3553

Closed
herjarsa wants to merge 2 commits into
cheaper-inference:mainfrom
herjarsa:fix/increase-fetch-timeout
Closed

herjarsa wants to merge 2 commits into
cheaper-inference:mainfrom
herjarsa:fix/increase-fetch-timeout

Conversation

@herjarsa

@herjarsa herjarsa commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Two related issues cause failures in OpenCode:

1. AbortError on slow connections

The default 10s timeout for /v1/models, /api/combos, and other fetch endpoints causes AbortError on WSL and other slow network setups where responses exceed 270KB.

2. 'No credentials for provider: combo'

OpenCode parses model IDs like combo/master and extracts combo as the provider name, ignoring the plugin's providerID: 'omniroute'. This causes authentication failures.

Solution

Timeout fix

  • Increase default timeouts from 10s to 60s for main fetchers
  • Increase enrichment/autoCombos timeouts from 5s to 30s
  • Update all call sites to use the new timeout values

Combo prefix fix

  • Remove combo/ prefix from buildComboKey so model IDs are just the slugified name (e.g., master instead of combo/master)
  • Prevents OpenCode from misinterpreting the combo name as a provider prefix

Testing

Verified on WSL2 with:

  • /v1/models response: 271KB, consistently took >10s to transfer
  • After fix: All fetchers complete successfully, no more AbortError warnings
  • Combo models now route correctly through omniroute provider

Notes

This is a minimal fix that addresses both timeout and authentication issues.

…n slow connections

The default 10s timeout for /v1/models, /api/combos, and other fetch
endpoints causes AbortError on WSL and other slow network setups where
responses exceed 270KB. This is especially problematic when the response
takes >10s to transfer.

Changes:
- Increase default timeouts from 10s to 60s for main fetchers
- Increase enrichment/autoCombos timeouts from 5s to 30s
- Update all call sites to use the new timeout values
- Prevents 'config shim: fetch failed' warnings on startup
@herjarsa
herjarsa requested a review from diegosouzapw as a code owner June 10, 2026 09:16

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request increases the default fetch timeouts from 10 seconds to 60 seconds (and 5 seconds to 30 seconds for auto-combos) across multiple fetchers and hooks in the plugin index file. The review feedback recommends defining these timeout values as constants at the top of the file to avoid magic numbers and duplication. Additionally, the reviewer notes that unit or integration tests should be added or updated to cover these production code changes, in accordance with the repository style guide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

baseURL,
apiKey,
timeoutMs = 10_000,
timeoutMs = 60_000,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Instead of hardcoding 60_000 across multiple fetchers and call sites, it is highly recommended to define this timeout as a constant at the top of the file (e.g., near DEFAULT_MODEL_CACHE_TTL_MS). This avoids magic numbers and improves maintainability.

For example, define:

export const DEFAULT_FETCH_TIMEOUT_MS = 60_000 as const;
Suggested change
timeoutMs = 60_000,
timeoutMs = DEFAULT_FETCH_TIMEOUT_MS,

*/
export const defaultOmniRouteAutoCombosFetcher: OmniRouteAutoCombosFetcher =
async (baseURL, apiKey, timeoutMs = 5_000) => {
async (baseURL, apiKey, timeoutMs = 30_000) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Similarly, define a constant for the autoCombos timeout (e.g., DEFAULT_AUTO_COMBOS_TIMEOUT_MS = 30_000 as const) at the top of the file to avoid magic numbers and duplication.

Suggested change
async (baseURL, apiKey, timeoutMs = 30_000) => {
async (baseURL, apiKey, timeoutMs = DEFAULT_AUTO_COMBOS_TIMEOUT_MS) => {

// disappearance). We do NOT wrap this in a try; let the error
// propagate to OC's UI.
rawModels = await fetcher(baseURL, apiKey, 10_000);
rawModels = await fetcher(baseURL, apiKey, 60_000);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

According to the Repository Style Guide (Rule 9 under Hard Rules), you must always include tests when changing production code in src/. Please ensure that appropriate unit or integration tests are added or updated under the tests/ directory to cover these new timeout values.

References
  1. Always include tests when changing production code (src/, open-sse/, electron/, bin/). (link)

…provider mismatch

OpenCode parses model IDs like 'combo/master' and extracts 'combo' as the
provider name, ignoring the plugin's providerID: 'omniroute'. This causes
'No credentials for provider: combo' errors.

Fix: Remove the 'combo/' prefix from buildComboKey so model IDs are just
the slugified name (e.g., 'master' instead of 'combo/master').

This is consistent with how raw models are registered - they don't use
a provider prefix in their IDs.
@herjarsa herjarsa changed the title fix(opencode-plugin): increase fetch timeouts to prevent AbortError on slow connections fix(opencode-plugin): increase fetch timeouts and remove combo/ prefix to fix provider errors Jun 10, 2026
@herjarsa

Copy link
Copy Markdown
Contributor Author

Closing in favor of #3551 which includes both fixes (timeout + combo prefix) with the correct approach (using omniroute/ prefix instead of removing combo/ entirely).

@herjarsa herjarsa closed this Jun 10, 2026
@kilo-code-bot

kilo-code-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

Kilo Code Review could not run — your account is out of credits.

Add credits or switch to a free model to enable reviews on this change.

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