Repository navigation
Conversation
…navailable Some plugin contexts (notably the V2 host) do not expose the provider directory, so refreshing the connectivity snapshot throws and ensureProviderConnected() denies providers that are actually configured. Fall back to the explicitly configured opencodeProvider so internal structured-output calls are still attempted; an invalid provider id still fails on the call and falls back to the external API.
rookie136
force-pushed
the
fix/provider-directory-fallback
branch
from
November 19, 2026 13:45
a654604 to
a756c60
Compare
This branch has not been deployed
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.
Problem
On OpenCode V2 (
0.0.0-beta-19271), the plugin context does not expose theproviderdomain (the runtime exposescataloginstead).refreshConnectedProviders()callsctx.client.provider.list(), which throws:Because the error path leaves
_connectedProvidersempty,ensureProviderConnected()denies providers that are actually configured and authenticated. Every internal structured-output call (auto-capture, profile learning, dedup, description evolution, AI cleanup) then throwsprovider '<id>' is not connectedand falls back to the external API (memoryApiUrl).In our setup that fallback path is non-streaming and sends large prompts, so the gateway holds the request until its 600s limit and returns HTTP 504 (observed:
status_code=504, duration 9m59s, request type非流).Fix
When the provider directory refresh fails, seed the connectivity snapshot with the explicitly configured
opencodeProvider:If the configured id is wrong, the structured-output call still fails loudly and the existing external fallback applies, so this does not hide misconfiguration. No behavior change when the host provider directory is available.
Verification
bunx tsc --noEmitpasses; pre-commit hooks (prettier/eslint) pass.opencodeProvider: "bs-aigw"+opencodeModel: "DeepSeek-V4-Flash"on V2 beta-19271:ctx.generate.text()pathAPI request timeout (60000ms), 0provider is not connectedafter restartNote
A longer-term fix could read provider connectivity from
ctx.catalogonce its API is stable; this change only makes the connectivity snapshot resilient when the provider directory is unavailable.