summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorCarlo Wood <[email protected]>2026-04-16 01:41:35 +0200
committerGitHub <[email protected]>2026-04-15 18:41:35 -0500
commita554fad2327c68b2dc562a19e62a96415028b6d8 (patch)
treeb36d552154432d67ba92edeb44784967c02741aa /packages
parent4dd0d1f67e6f600f629617e3b7c7881f4d4a1a6e (diff)
downloadopencode-a554fad2327c68b2dc562a19e62a96415028b6d8.tar.gz
opencode-a554fad2327c68b2dc562a19e62a96415028b6d8.zip
fix(tui): Don't overwrite the agent that was specified on the command line (#20554)
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx5
1 files changed, 4 insertions, 1 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 5a3e1d451..d0f5b481c 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
@@ -37,6 +37,7 @@ import { useToast } from "../../ui/toast"
import { useKV } from "../../context/kv"
import { useTextareaKeybindings } from "../textarea-keybindings"
import { DialogSkill } from "../dialog-skill"
+import { useArgs } from "@tui/context/args"
export type PromptProps = {
sessionID?: string
@@ -81,6 +82,7 @@ export function Prompt(props: PromptProps) {
const keybind = useKeybind()
const local = useLocal()
+ const args = useArgs()
const sdk = useSDK()
const route = useRoute()
const sync = useSync()
@@ -202,7 +204,8 @@ 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) {
- local.agent.set(msg.agent)
+ // 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)