Skip to content

Commit a7e8a73

Browse files
committed
fix(opencode): stop overwriting manual model selection on agent data refresh
Remove the createEffect that enforced the agent's default model whenever agent state was refreshed by the server. The currentModel memo already handles fallback correctly through its priority chain: 1. Per-agent manual selection (modelStore.model[agentName]) 2. Agent configured default (agent.model) 3. Global fallback (CLI arg / config / recent) The effect was redundant and harmful: any server sync that updated agent data would re-trigger it, silently replacing the user's manual model choice with the agent's default. Fixes anomalyco#13456
1 parent d1482e1 commit a7e8a73

1 file changed

Lines changed: 1 addition & 19 deletions

File tree

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

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

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createStore } from "solid-js/store"
2-
import { batch, createEffect, createMemo } from "solid-js"
2+
import { batch, createMemo } from "solid-js"
33
import { useSync } from "@tui/context/sync"
44
import { useTheme } from "@tui/context/theme"
55
import { uniqueBy } from "remeda"
@@ -381,24 +381,6 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
381381
},
382382
}
383383

384-
// Automatically update model when agent changes
385-
createEffect(() => {
386-
const value = agent.current()
387-
if (value.model) {
388-
if (isModelValid(value.model))
389-
model.set({
390-
providerID: value.model.providerID,
391-
modelID: value.model.modelID,
392-
})
393-
else
394-
toast.show({
395-
variant: "warning",
396-
message: `Agent ${value.name}'s configured model ${value.model.providerID}/${value.model.modelID} is not valid`,
397-
duration: 3000,
398-
})
399-
}
400-
})
401-
402384
const result = {
403385
model,
404386
agent,

0 commit comments

Comments
 (0)