From 7d55ba4581e2891aedd6cbc986451bfbfb36bf68 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Mon, 1 Jun 2026 14:36:06 -0500 Subject: [PATCH 1/3] wip --- .opencode/opencode.jsonc | 2 ++ .../opencode/src/cli/cmd/tui/component/prompt/index.tsx | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.opencode/opencode.jsonc b/.opencode/opencode.jsonc index 7f07577f8c2f..0646c90deae5 100644 --- a/.opencode/opencode.jsonc +++ b/.opencode/opencode.jsonc @@ -1,4 +1,6 @@ { + "model": "anthropic/claude-opus-4-8", + // "default_agent": "custom", "$schema": "https://opencode.ai/config.json", "provider": {}, "permission": {}, diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index d2877dd77f3c..8f475712ead9 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -405,9 +405,12 @@ export function Prompt(props: PromptProps) { // Only set agent if it's a primary agent (not a subagent) const isPrimaryAgent = local.agent.list().some((x) => x.name === msg.agent) if (msg.agent && isPrimaryAgent) { - // Keep command line --agent if specified. - if (!args.agent) local.agent.set(msg.agent) - if (msg.model) { + // Keep an explicitly configured agent (--agent flag or config "default_agent") instead + // of flipping to the session's last-used agent when navigating between sessions. + if (!args.agent && !sync.data.config.default_agent) local.agent.set(msg.agent) + // Keep an explicitly configured model (--model flag or config "model") instead of + // flipping to the session's last-used model when navigating between sessions. + if (msg.model && !args.model && !sync.data.config.model) { local.model.set(msg.model) local.model.variant.set(msg.model.variant) } From 10252bab839e6ff9dbeee2d99ddcfa06e2d11e19 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Mon, 1 Jun 2026 15:39:58 -0500 Subject: [PATCH 2/3] wip --- .../opencode/src/cli/cmd/tui/component/prompt/index.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index 8f475712ead9..d2877dd77f3c 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -405,12 +405,9 @@ export function Prompt(props: PromptProps) { // Only set agent if it's a primary agent (not a subagent) const isPrimaryAgent = local.agent.list().some((x) => x.name === msg.agent) if (msg.agent && isPrimaryAgent) { - // Keep an explicitly configured agent (--agent flag or config "default_agent") instead - // of flipping to the session's last-used agent when navigating between sessions. - if (!args.agent && !sync.data.config.default_agent) local.agent.set(msg.agent) - // Keep an explicitly configured model (--model flag or config "model") instead of - // flipping to the session's last-used model when navigating between sessions. - if (msg.model && !args.model && !sync.data.config.model) { + // Keep command line --agent if specified. + if (!args.agent) local.agent.set(msg.agent) + if (msg.model) { local.model.set(msg.model) local.model.variant.set(msg.model.variant) } From 5c6356f5a6a65f03b2cfa127d04e178b8bac77e1 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Mon, 1 Jun 2026 16:06:16 -0500 Subject: [PATCH 3/3] fix(tui): keep configured model and agent when navigating sessions Navigating between sessions adopted the session's last-used model and agent, which overrode an explicitly configured model/default_agent (or --model/--agent). Skip the auto-adoption when an explicit selection exists so the user's configured choice sticks. --- .opencode/opencode.jsonc | 2 -- .../opencode/src/cli/cmd/tui/component/prompt/index.tsx | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.opencode/opencode.jsonc b/.opencode/opencode.jsonc index 0646c90deae5..7f07577f8c2f 100644 --- a/.opencode/opencode.jsonc +++ b/.opencode/opencode.jsonc @@ -1,6 +1,4 @@ { - "model": "anthropic/claude-opus-4-8", - // "default_agent": "custom", "$schema": "https://opencode.ai/config.json", "provider": {}, "permission": {}, diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index d2877dd77f3c..8f475712ead9 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -405,9 +405,12 @@ export function Prompt(props: PromptProps) { // Only set agent if it's a primary agent (not a subagent) const isPrimaryAgent = local.agent.list().some((x) => x.name === msg.agent) if (msg.agent && isPrimaryAgent) { - // Keep command line --agent if specified. - if (!args.agent) local.agent.set(msg.agent) - if (msg.model) { + // Keep an explicitly configured agent (--agent flag or config "default_agent") instead + // of flipping to the session's last-used agent when navigating between sessions. + if (!args.agent && !sync.data.config.default_agent) local.agent.set(msg.agent) + // Keep an explicitly configured model (--model flag or config "model") instead of + // flipping to the session's last-used model when navigating between sessions. + if (msg.model && !args.model && !sync.data.config.model) { local.model.set(msg.model) local.model.variant.set(msg.model.variant) }