Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 9886353

Browse files
committed
fix: persist -m model when switching agents
Add initial model from command line to fallback chain so it persists when switching agents with tab, matching behavior of config model. Resolves anomalyco#3863
1 parent f501501 commit 9886353

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • packages/opencode/src/cli/cmd/tui/context

packages/opencode/src/cli/cmd/tui/context/local.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
150150
})
151151

152152
const fallbackModel = createMemo(() => {
153+
if (props.initialModel) {
154+
const { providerID, modelID } = Provider.parseModel(props.initialModel)
155+
if (isModelValid({ providerID, modelID })) {
156+
return {
157+
providerID,
158+
modelID,
159+
}
160+
}
161+
}
162+
153163
if (sync.data.config.model) {
154164
const { providerID, modelID } = Provider.parseModel(sync.data.config.model)
155165
if (isModelValid({ providerID, modelID })) {

0 commit comments

Comments
 (0)