fix: refresh stale directory provider state#443
Merged
Conversation
Comment on lines
+247
to
+251
| const globalRes = await globalClient.provider.list() | ||
| const globalData = globalRes.data as ProviderListData | undefined | ||
| const stale = (globalData?.connected ?? []).some((id) => !data.connected.includes(id)) | ||
| if (stale) { | ||
| await client.instance.dispose() |
Comment on lines
+245
to
+253
| if (directory) { | ||
| try { | ||
| const globalRes = await globalClient.provider.list() | ||
| const globalData = globalRes.data as ProviderListData | undefined | ||
| const stale = (globalData?.connected ?? []).some((id) => !data.connected.includes(id)) | ||
| if (stale) { | ||
| await client.instance.dispose() | ||
| const refreshed = await client.provider.list() | ||
| const refreshedData = refreshed.data as ProviderListData | undefined |
Comment on lines
+246
to
+257
| try { | ||
| const globalRes = await globalClient.provider.list() | ||
| const globalData = globalRes.data as ProviderListData | undefined | ||
| const stale = (globalData?.connected ?? []).some((id) => !data.connected.includes(id)) | ||
| if (stale) { | ||
| await client.instance.dispose() | ||
| const refreshed = await client.provider.list() | ||
| const refreshedData = refreshed.data as ProviderListData | undefined | ||
| if (refreshedData) return normalizeProviderData(refreshedData) | ||
| } | ||
| } catch (e) { | ||
| console.warn("Failed to refresh stale directory provider state:", e) |
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
Diagnosis
In the Kubeflow OpenCode notebook, /provider without x-opencode-directory returned connected providers [openai, opencode], but /provider with x-opencode-directory for /home/jovyan/kubeflow-examples returned only [opencode]. The model picker uses the directory-scoped SDK client, so it only showed OpenCode/Open Zen models until the directory instance was manually disposed.
Verification