GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(provider): keep configured provider connected when directory is unavailable by rookie136 · Pull Request #513 · tickernelz/opencode-mem

Conversation

@rookie136

@rookie136 rookie136 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Problem

On OpenCode V2 (0.0.0-beta-19271), the plugin context does not expose the provider domain (the runtime exposes catalog instead). refreshConnectedProviders() calls ctx.client.provider.list(), which throws:

TypeError: undefined is not an object (evaluating 'ctx.provider.list')

Because the error path leaves _connectedProviders empty, ensureProviderConnected() denies providers that are actually configured and authenticated. Every internal structured-output call (auto-capture, profile learning, dedup, description evolution, AI cleanup) then throws provider '<id>' is not connected and 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:

} catch (error) {
  log("Failed to refresh opencode provider state", { error: String(error) });
  if (CONFIG.opencodeProvider) {
    const { setConnectedProviders } = await loadOpencodeProvider();
    setConnectedProviders([CONFIG.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 --noEmit passes; pre-commit hooks (prettier/eslint) pass.
  • With opencodeProvider: "bs-aigw" + opencodeModel: "DeepSeek-V4-Flash" on V2 beta-19271:
    • auto-capture and profile learning complete through the host ctx.generate.text() path
    • plugin log: 0 external fallbacks, 0 API request timeout (60000ms), 0 provider is not connected after restart
  • Gateway request log changed from non-stream 504 (599s) to streaming (first token 2.8s, total 7.0s).

Note

A longer-term fix could read provider connectivity from ctx.catalog once its API is stable; this change only makes the connectivity snapshot resilient when the provider directory is unavailable.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rookie136
fix(provider): keep configured provider connected when directory is u…
a756c60
…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
rookie136 force-pushed the fix/provider-directory-fallback branch from a654604 to a756c60 Compare November 19, 2026 13:45
@EyJunge1
fix(provider): load connectivity fallback via opencode provider loader
695b00a
Use loadOpencodeProvider in the directory-unavailable catch path so
setConnectedProviders updates the same module instance that
ensureProviderConnected reads.
@EyJunge1
EyJunge1 merged commit ffd6a2c into tickernelz:main Nov 24, 2026
This was referenced Nov 24, 2026
fix(web): allow tag migration when only external provider is ready #520
Merged
chore(release): release v2.44.0 #522
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rookie136 @EyJunge1
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.