fix: move provider hook models to config hook#17
Merged
Merged
Conversation
Populate provider.models via the config hook instead of the deprecated provider hook. Also unpin opencode image version in the integration test compose file.
Write schema-valid provider model entries from the config hook so OpenCode can load local models without config validation errors. Also always pull the opencode test image so the integration container uses the latest CLI.
goniz
commented
May 9, 2026
Comment on lines
+127
to
+134
| const models = await probeModels( | ||
| { | ||
| id: LOCAL_PROVIDER_ID, | ||
| options, | ||
| models: (provider as Provider).models ?? ({} as Record<string, Model>), | ||
| } as unknown as Provider, | ||
| {} as ProviderHookContext, | ||
| ) |
Owner
Author
There was a problem hiding this comment.
Why keep passing this uneeded signature? Simplify this now that we are not being called from a hook
| } as unknown as Provider, | ||
| {} as ProviderHookContext, | ||
| ) | ||
| ;(cfg.provider[LOCAL_PROVIDER_ID] as Record<string, unknown>).models = configModels(models) |
| } | ||
| } | ||
|
|
||
| function configModel(model: Model) { |
Owner
Author
There was a problem hiding this comment.
Maybe we can simplify the underlying probe function to yield either ModelConfig or ProviderConfig? We can have two overrides . Instead of converting schemas
Keep runtime provider model construction available while giving the config hook a dedicated config-schema builder. This removes the stale hook-shaped probe call and simplifies config model assignment.
goniz
commented
May 9, 2026
Comment on lines
63
to
+77
| cfg.provider[LOCAL_PROVIDER_ID] = { | ||
| ...provider, | ||
| name: provider.name ?? LOCAL_PROVIDER_NAME, | ||
| npm: provider.npm ?? OPENAI_COMPATIBLE_NPM, | ||
| options, | ||
| } | ||
|
|
||
| const models = await probeModels({ | ||
| options, | ||
| models: (provider as Provider).models, | ||
| }) | ||
| cfg.provider[LOCAL_PROVIDER_ID] = { | ||
| ...(cfg.provider[LOCAL_PROVIDER_ID] as Record<string, unknown>), | ||
| models, | ||
| } |
Owner
Author
There was a problem hiding this comment.
Merge this all into a single op
Comment on lines
+147
to
+154
| export function buildConfig(target: string, url: string, list: LocalModel[], prev: Record<string, ConfigModel>) { | ||
| return Object.fromEntries( | ||
| list.map((model) => { | ||
| const key = id(target, model.id) | ||
| return [key, configItem(target, url, model, prev[key])] | ||
| }), | ||
| ) | ||
| } |
Owner
Author
There was a problem hiding this comment.
I want the ConfigModel return type to only contain what's actually been set! I don't want it to be full type verbose like now.
Merge config hook model updates into a single assignment and keep the config model shape limited to fields we actually reuse. Also preserve attachments when vision support is present.
Drop verbose config-only fields and avoid forcing incorrect reasoning or tool-call flags into probed local models. Preserve attachments when vision support is present.
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.
Broken in OpenCode 1.14.31+