Repository navigation
fix(configure): stop pinning a default model for OpenCode and CoDev Code - #221
Merged
Merged
Conversation
The install-time model choice exists because Claude Code and Codex can only replace their proprietary model with a single one (docs/hub/installation); OpenCode and CoDev Code switch freely in-CLI. Writing the choice as a top-level `model` in their configs outranked that in-CLI selection on every launch — the pin beats the recent models in their state dir — so each /models switch reverted on restart and only hand-editing the config undid it. Every install, `codevhub model` run, and gateway-key refresh rewrote the pin back. configureOpenCodeKind no longer emits `model`. The chosen model now leads the provider's models map instead, so a first launch with nothing selected still lands on it while any later in-CLI switch wins for good. Claude Code, Codex, and Continue are untouched — `codevhub model` still steers those authoritatively, and its completion line now says where the in-CLI choice rules instead of implying it changed those two. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
quickbeard
added a commit
that referenced
this pull request
Jul 30, 2026
PR #221 stopped emitting a top-level `model` in the OpenCode-family configs, which left `OPENCODE_K.model` with no reader. Biome doesn't flag an unused object property, so it survived. Pure removal — the comment at the write site already explains why no pin is written, and CoDev Code shares this constant table via configureOpenCodeKind, so nothing else references it. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
quickbeard
added a commit
that referenced
this pull request
Jul 31, 2026
#229) Dropping the top-level `model` pin (#221) relied on the chosen model leading the models map, but map order never carried the choice: with no pin and no saved selection the OpenCode-family TUI falls back to the first provider in its list — upstream's hosted Zen provider, which self-registers ahead of config providers — so a fresh install started on "Big Pickle · OpenCode Zen" instead of the gateway (and, within a provider, the server's own sort picks the model, not the map). Write the install-time choice where the TUI actually reads it: the state dir's model.json `recent` list, its highest-priority startup source after a config pin. Seed only when the recents list is empty or absent — this writer also runs on every gateway-key auto-refresh and `codevhub model`, and a non-empty list is a selection the user already made that must keep winning. Favorites/variants are carried over, a corrupt state file is replaced, and any filesystem failure is swallowed (the seed is a nicety; the config write already succeeded). Counterpart to codev-code#144, which fixes the TUI-side fallback to skip the Zen registration; either alone fixes the visible default, this one additionally makes the wizard's chosen model stick. Co-authored-by: Quickbeard <quickbeard@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
Why
Per the install docs, the model choice exists for the tools that can't switch:
configureOpenCodeKindnevertheless wrote that choice into~/.config/opencode/opencode.jsonand~/.config/codev/codev.jsoncas a top-level"model": "<provider>/<id>". That key outranks the in-CLI selection on every launch — OpenCode resolves configmodelbefore the recent models in its state dir — so every/modelsswitch silently reverted on restart, and the only fix was hand-editing the config. All three writer paths reapplied it:codevhub install,codevhub model, and the gateway-key auto-refresh inrefresh.ts.What changed
configureOpenCodeKindno longer writesmodel. Claude Code, Codex, and Continue are untouched — the model choice still works exactly as documented for them.modelsmap ([defaultModel, ...creds.models], deduped). With no pin, a launch with nothing selected falls through to the provider's first model, so ordering carries the choice for a fresh install while yielding to any later in-CLI switch.codevhub model's completion line adds a dim second line —In OpenCode and CoDev Code, switch models anytime with /models.— so it no longer reads as authoritative for the two tools it can only suggest to.Nothing in the hub reads the pin back (
readOpenCodeConfiguses the provider block for baseUrl/identity), so removing it doesn't affect detection, doctor, restore, or remove.Testing
pnpm check,pnpm typecheck,pnpm test— 70 files, 1251 tests, all passing. Updated the assertions that pinnedconfig.modelfor both the opencode and codev-code writers plus the custom-provider identity cases (now asserted through the provider map), and added coverage for the newcodevhub modelline.Related
Fork-side counterpart: quickbeard/codev-code#142 removes the same pin from CoDev Code's own SSO setup flow (
buildGatewayConfig), which wrote a hub-shaped block. With both merged, no writer produces the pin.🤖 Generated with Claude Code