fix(server): send OpenCode Go models as bare runtime IDs - #7247
Open
imMxts wants to merge 4 commits into
Open
Conversation
) OpenCode looks up provider.models[modelID], so a duplicated opencode-go/ prefix on the model ID is rejected. Keep the application slug namespaced and strip the extra prefix at the OpenCode runtime seam. Inventory slugs now use the catalog map key so discovery matches that same request shape. Co-authored-by: Mats Varnskühler <imMxts@users.noreply.github.com>
General duplicate-prefix stripping would rewrite a legitimate catalog key that starts with provider/ (huggingface/huggingface/CodeBERTa). Keep first-slash parsing for all providers, and only peel a repeated opencode or opencode-go prefix at the runtime seam. Inventory still uses the catalog map key. Co-authored-by: Mats Varnskühler <imMxts@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Drop duplicate sendTurn copies that the runtime helper unit tests already cover, matching the smaller first-time contributor PRs that landed. Co-authored-by: Mats Varnskühler <imMxts@users.noreply.github.com>
imMxts
marked this pull request as ready for review
August 16, 2026 20:02
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.
What Changed
Inventory slugs for OpenCode models are built from the catalog map key, not
model.id.sendTurnand text generation then strip a duplicatedopencode/oropencode-go/prefix before the runtime request, so Go models go out as{ providerID: "opencode-go", modelID: "deepseek-v4-pro" }. Other catalogs that legitimately use a key starting withprovider/are left alone.Why
Fixes #3571. When
model.idwas already namespaced, the picker storedopencode-go/opencode-go/deepseek-v4-pro. First-slash parse then sentmodelID: "opencode-go/deepseek-v4-pro", which OpenCode'sgetModelrejects.Not covered: a correctly split
{ providerID: "opencode-go", modelID: "deepseek-v4-pro" }can still fail if the spawned OpenCode server does not have that model in its live catalog (auth/subscription). That is outside this serialization fix.UI Changes
None.
Checklist
Note
Low Risk
Targeted serialization and inventory slug logic for OpenCode models with broad test coverage; no auth or data-path changes.
Overview
Fixes OpenCode Go / Zen model selection when inventory
model.idis already namespaced, which produced slugs likeopencode-go/opencode-go/deepseek-v4-proand caused the runtime to reject the request.Inventory slugs are now built from each provider’s catalog map key (
provider.id+ key), not frommodel.id, so the picker exposesopencode-go/deepseek-v4-proeven when JSONidis prefixed.Runtime requests (
sendTurn, text generation) go throughtoOpenCodeRuntimeModel, which splitsprovider/modeland, for hostedopencode/opencode-goonly, strips a repeated provider prefix frommodelID. Keys that legitimately start withprovider/(e.g. Hugging Face) are unchanged. Bare model IDs still fail validation with the existingprovider/modelmessage.Reviewed by Cursor Bugbot for commit fb8becd. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix OpenCode Go model slugs to send bare runtime IDs by stripping duplicated provider prefixes
flattenOpenCodeModelsin OpenCodeProvider.ts now builds slugs from the inventory map key instead ofmodel.id, avoiding duplicated prefixes likeopencode-go/opencode-go/....toOpenCodeRuntimeModelin opencodeRuntime.ts which strips repeated leading provider segments for hosted OpenCode providers (opencode,opencode-go) while leaving other providers unchanged.parseOpenCodeModelSlugwithtoOpenCodeRuntimeModelin thesendTurnhandler and text generation path so duplicated prefixes are normalized before the CLI is invoked.Macroscope summarized fb8becd.