You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(opencode): read v2's native default variant as the Default option - #537
AI assistance disclosure: this change was prepared with help from an AI coding assistant. I reviewed the diff and ran the commands listed above myself.
Reviewing files that changed from the base of the PR and between 1aa9f65 and 3a83bab.
📒 Files selected for processing: 2
packages/adapters/opencode/src/v2/state.ts
packages/adapters/opencode/test/v2.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Comment @coderabbitai help to get the list of available commands.
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
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
OpenCode v2 的会话读取接口把默认 Thinking 变体原样返回为字符串
"default"。v2Catalog()用encodeOpenCodeVariant(undefined)表示默认档位(ocv.default),而v2State()把原生的"default"当成普通变体名编码成ocv.ZGVmYXVsdA,不在该模型的availableThinkingOptions里,于是harnessConfigurationStateSchema拒绝状态,界面显示「无法切换模型 / Model state was not confirmed」,而原生会话其实已经切换。改动只在 v2 原生状态转换边界(
packages/adapters/opencode/src/v2/state.ts):effectiveVariant():原生变体为"default",且该模型的supportedThinkingOptionIds里没有名为default的真实变体时,映射为目录的 Default 选项ocv.default。default的变体,保留其原有 ID,不做合并。encodeOpenCodeVariant/opencode-adapter.ts)和状态 schema 校验都没有改动。Related issues
Fixes #528
Test plan
packages/adapters/opencode/test/v2.test.ts中的OpenCode v2 Thinking state三个用例(原生"default"→ocv.default且在可用列表中;模型自己声明default变体时保留;显式变体high保持原 ID)。reads the native default variant as the catalog's Default option失败,expected 'ocv.ZGVmYXVsdA' to be 'ocv.default'。npx tsc -b后npx vitest run --config tests/vitest.config.js packages/adapters/opencode/test/:12 files passed / 2 skipped(real 测试),123 passed / 3 skipped。npx tsc -p tests/tsconfig.json --noEmit:通过。npx eslint两个改动文件、node tools/check-boundaries.mjs、npx prettier --check两个改动文件:通过。npm test(含 Rust 部分),只跑了 OpenCode adapter 的定向测试。Node v24.21.0,Linux x64。AI assistance disclosure: this change was prepared with help from an AI coding assistant. I reviewed the diff and ran the commands listed above myself.